Author |
Message
|
ruchir123 |
Posted: Thu Jan 26, 2012 9:41 pm Post subject: Wait for 5 seconds to continue flow |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Hi All,
I have a requirement in which i need to wait for 5 seconds at some point in my flow and then continue with my flow.
So please suggest how we can make our flow to wait for 5 seconds and then continue.
I am working on WMB 6.1.
Please
Thanks a ton in advance. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jan 26, 2012 11:31 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
In 6.1 you can't use the SLEEP Function so you will have to do it the hard way with timer nodes.
This topic comes up every so often here. Personally, I think it is a bad idea.
[url]
http://fixunix.com/websphere/212732-esql-compute-node-delay-required.html[/url]
A quick google for 'ESQL Sleep' turns up the above thread. THe post by a certain Mr Andy Piper of IBM tells you why this is a bad idea. I stand by this.
If you really are trying to use Broker as an AppServer then by all means drop into Java and code a sleep.
If you don't want to block the whole processing because you are 'sleeping' then you shoud configure in some additional instances.
IMHO, this ranks alongisde 'Message Affinity' as pretty well the top two broker bad practices (unless you use timer nodes...) _________________ 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 |
|
 |
lancelotlinc |
Posted: Fri Jan 27, 2012 6:00 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
I agree its not a good idea. But you can use "sleep" from JCN.
However, your violating the principle of Enterprise Service Bus. ESB is a high-speed messaging engine. If you put the breaks on for 5 seconds, its no longer a high speed messaging engine.
Dont use State. Dont use Sleep. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
ruchir123 |
Posted: Sun Jan 29, 2012 2:45 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Hi smdavies99 and lancelotlinc,
thanks for your replies and sorry for the late response.
smdavies99 : i thought of using the timer node but when i m using Timeout Notification Node all my environment variables are lost and also i m facing one more issue , in case of controlled use of Timeout Notification Node , if i set counter of Timeout Control node to 5 , then in every working of Timeout Notification Node it is getting the same Input Message, if i want to change the input message then please tell me how to achieve it. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Jan 29, 2012 4:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
ruchir123 wrote: |
Hi smdavies99 and lancelotlinc,
thanks for your replies and sorry for the late response.
smdavies99 : i thought of using the timer node but when i m using Timeout Notification Node all my environment variables are lost and also i m facing one more issue , in case of controlled use of Timeout Notification Node , if i set counter of Timeout Control node to 5 , then in every working of Timeout Notification Node it is getting the same Input Message, if i want to change the input message then please tell me how to achieve it. |
You said you wanted to pause the processing of your flow for five seconds.
You now are appearing to say you want to pause the processing of each message for five seconds. That's a very different requirement than the other one.
And it's an even worse idea.
You need to rethink this idea. |
|
Back to top |
|
 |
adubya |
Posted: Sun Jan 29, 2012 6:17 am Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
Perhaps if we wind things back a bit and you tell us why you believe a 5 second delay is required then we could understand your issue better ? |
|
Back to top |
|
 |
ruchir123 |
Posted: Sun Jan 29, 2012 10:57 pm Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Actually i have a scenario where my flow is calling a buffer , which i need to call continuously on a delay of 5 seconds until i get full data from that buffer flow. So in this case i need my flow to rerun at a interval of 5 seconds and also need to change my input message to the buffer flow , because buffer flow will run on the required input account number that i m providing it as input message and will return me details of those account numbers. So if still details of some account numbers is left, then again i will wait for 5 seconds , according to remaining account numbers i will again form a request for buffer flow and will again call. This process will continue till i didn't get details of all the accounts.
I think i cleared my need, so please suggest what can be done for this. |
|
Back to top |
|
 |
adubya |
Posted: Mon Jan 30, 2012 12:36 am Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
OK, I *think* I understand your requirement.
Basically you're retrieving account information from an external (to Broker) source. The external source needs to be accessed (potentially) multiple times to retrieve all the account data with each request to the source varying depending upon the account details still to be received. Once all accounts have been received then you stop querying the source. Requests to the source need to be no less than 5 seconds apart.
Well if the above is correct then how about using a DB to store the state of account query requests i.e. as the account data is returned then build up the DB with the results, when no data is returned then all accounts have been retrieved and all your acct data is available in the DB. Associate a last request timestamp with each "batch" of accounts and have your worker broker thread look for work by finding all batches where the last request timestamp is 5 seconds or more in the past. The timestamp is then updated to current timestamp when you make your request to the data source.
That's the first option that comes into my head, if I thought about it some more then no doubt a whole load more would
Basically, keep your broker threads as short running as possible, don't introduce artificial delays into them and keep state information out of broker  |
|
Back to top |
|
 |
ruchir123 |
Posted: Mon Jan 30, 2012 2:39 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Hi adubya,
Thanks for your reply.
Yes, you got my requirement.
But i have a issue with that.
If we use DB, then we need a DB table to store my info, in my case i am exposing my service as webservice, so my client will not allow me to create an extra Table in there server for this purpose. So i think using DB will not work for me. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 30, 2012 2:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can use an MQGet node against an empty queue, with a wait time of 5 seconds. |
|
Back to top |
|
 |
ruchir123 |
Posted: Mon Jan 30, 2012 2:44 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
adubya wrote: |
Associate a last request timestamp with each "batch" of accounts and have your worker broker thread look for work by finding all batches where the last request timestamp is 5 seconds or more in the past. The timestamp is then updated to current timestamp when you make your request to the data source |
Sorry, i didn't get this. I think you are saying to store timestamp and then check for all past timestamp for to be 5 or more. Then again to update timestamp when requesting to datasource.
I hope i m right. But please tell how this is helping in my issue. I didn't understand this. |
|
Back to top |
|
 |
ruchir123 |
Posted: Mon Jan 30, 2012 2:48 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
mqjeff wrote: |
You can use an MQGet node against an empty queue, with a wait time of 5 seconds. |
Currently i m using this method. But in this case we must have a queue with that name in Queue Manager. Which is a problem with me and also i was not sure whether it is a good way to handle this scenario. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jan 30, 2012 5:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ruchir123 wrote: |
Actually i have a scenario where my flow is calling a buffer , which i need to call continuously on a delay of 5 seconds until i get full data from that buffer flow. |
I think many of the issues were covered in your previous thread on this subject here. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ruchir123 |
Posted: Mon Jan 30, 2012 9:55 pm Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Yes Vitor,
But still i am stuck how to fix my issue, only solution i got is what mqjeff also suggested. So i am asking you experts is it the right way to implement my scenario or we bhave some other way around. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jan 30, 2012 10:20 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
ruchir123 wrote: |
But in this case we must have a queue with that name in Queue Manager. Which is a problem with me and also i was not sure whether it is a good way to handle this scenario. |
Why is this a problem for you to have a queue to read from? After all, you already have a queue manager?
If it is difficult to create a queue then there are queues already defined on your QM that you could use to read from with the right parameters. _________________ 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 |
|
 |
|