ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » retry requests with time interval.

Post new topic  Reply to topic
 retry requests with time interval. « View previous topic :: View next topic » 
Author Message
sravan
PostPosted: Mon Jun 25, 2012 3:16 pm    Post subject: retry requests with time interval. Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

I have the following design

MQ Request --> build a REST based request --> if sucessful response send a notification by email.

if unsucessful response call the REST webservice with a timedelay(upto few mints) until sucessful response upto 9 times.

I want to know the best approach to call the REST service with delay as holding the flow for few mints can cause issues with the EG.
_________________
skr_wmb
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Jun 25, 2012 5:21 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

There are exactly twelve ways to solve this delima. Once way could be to deposit the message into a queue with a CorrelId key by two minute intervals. Then set the MQGet node to Get By CorrelId for that time value.

Another way, if you know how to use the Java programming language (who doesn't?), is to use an Executor.

http://stackoverflow.com/questions/2275443/how-to-timeout-a-thread

Or TimeoutController

http://www.java2s.com/Code/Java/Threads/Executesataskwithaspecifiedtimeout.htm

Or timer

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html


Or use a database.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Jun 26, 2012 1:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It may not be obvious to most viewers, but lancelotlinks suggestions are all excellent suggestions, but should be viewed as "the hard way".

Except the bit about using a database. That's not a bad way, depending entirely on how the database schema is laid out.

Two common ways to do this in Broker use message expiry or use a TimeoutControl/TimeoutNotification node pair.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jun 26, 2012 2:15 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

lancelotlinc wrote:

Another way, if you know how to use the Java programming language (who doesn't?)


sigh.
Not every Broker developer knows or even wants to know Java.
There are some of us who'd clearly rather write JCL/Cobol or even Coral-66 than write Java code. Personally, I find it just a PITA to use. This is probably because I don't have to use it very often(about as often a Cobol these days) in order to get my job done. I know that I am not alone here.

Naturally, every site is different. Many of us know from you past posts that you seem to almost love and worship the Java subsystem. Not all of us are a fortunate as your esteemed self.

_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Esa
PostPosted: Tue Jun 26, 2012 3:29 am    Post subject: Re: retry requests with time interval. Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

sravan wrote:

I want to know the best approach to call the REST service with delay as holding the flow for few mints can cause issues with the EG.


I interpret this that your flow is getting a lot of calls that should be forwarded to the REST service. The issues with the EG are either memory getting low or the flow running out of instances.

The java alternatives suggested by lancelotlinc are all holding the flow, they are all more or less putting the thread into sleep while keeping all resources (parsers, memory etc). So obviously they are not going to relieve you from the EG issues. Besides, Message Broker is optimized to run short-lived, transactional microflows, so I would say that Thread.sleep() is seldom part of a Message Broker best practice solution.

TimeOutControl/TimeoutNotification pair would be a pure Message Broker solution.

But if you really have for example hundreds of requests coming in every minute, that migth accumulate a lot of delayed processing if the endoint stays down for a longer period. In that case I would start putting the messages onto a queue after the first unsuccessful response and use Timeout nodes to start a delayed process that would browse the first message, test the service and consume the whole queue when the endpoint has started to respond. To implement this kind of a flow is not a very basic task, and there are issues that I have not mentioned in this brief description. So let's hope you have a modest message rate so that you can manage with delayed processing with a simple TimeoutControl/TimeoutNotification pair.

corrected "memory getting flow" ---> "memory getting low"


Last edited by Esa on Tue Jun 26, 2012 4:59 am; edited 1 time in total
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 26, 2012 4:38 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Also note that if you have message affinity, your best plan might be to stop the flow and page somebody to fix the problem...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
lancelotlinc
PostPosted: Tue Jun 26, 2012 5:25 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

smdavies99 wrote:
lancelotlinc wrote:

Another way, if you know how to use the Java programming language (who doesn't?)
sigh. Not every Broker developer knows or even wants to know Java. There are some of us who'd clearly rather write JCL/Cobol or even Coral-66


As a matter of policy, I am technology agnostic. Whatever fits best is what I use. Seeing that the last public domain contribution for Coral-66 code was in 1969, and that many contributions for another unspecified language are on-going, I tend to choose the implementation that has the most on-going community support.

But we still like old dogs. They bark at strangers.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER


Last edited by lancelotlinc on Tue Jun 26, 2012 5:40 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Jun 26, 2012 5:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

There are surely a number of interesting patterns and designs for solving this with .NET in Broker v8.

If you're using Broker v8. And on windows.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 26, 2012 5:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lancelotlinc wrote:
But we still like old dogs. They still bark at strangers.


And when the revolution comes, the young will be locked in a compound & made to write CORAL-66, COBOL-68 & FORTRAN on 80 column cards which will be processed by stream powered card readers.

We can get the steam by burning all the books on rapid application methodolgies, data warehousing & content driven formatting.

While we all bark at strangers.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sravan
PostPosted: Tue Jun 26, 2012 11:36 am    Post subject: Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

Thanks for your suggestions.
_________________
skr_wmb
Back to top
View user's profile Send private message
sravan
PostPosted: Tue Jun 26, 2012 11:43 am    Post subject: Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

Unsucessful response from the REST webservice provider does not mean the system is down,It may due to delayed processing of FAX servicing of requests which are independent of each other).

I am hoping to use the timeout control for delayed processing after selectively browsing from the queue when there is a unsucessful response.
But this does hold the flow.
_________________
skr_wmb
Back to top
View user's profile Send private message
Esa
PostPosted: Tue Jun 26, 2012 11:24 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

sravan wrote:

I am hoping to use the timeout control for delayed processing after selectively browsing from the queue when there is a unsucessful response.
But this does hold the flow.


You are more than a bit unclear, but one could get the impression that you are using MQ for sending the REST messages and an MQGet node for browsing the responses?

If that is the case you could move to asynchronous model and put all requests in a queue after sending them (with expiration and MsgId copied from writtenDestination) and make another flow receive the responses. Then you could get the requests that match unsuccessful responses and feed them back to the request flow via timeout nodes. Provided the REST service follows basic MQ/JMS conventions and copies request MsgId to response correlId, for example. Something in your post makes me think that it may not be the case... Well, that can be made work even if you had to examine the contents of the messages while browsing, it's would just be slower.

That would not "hold the flow", which, I guess, is your expression for synchronous processing.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » retry requests with time interval.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.