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 » How to delay the Message Flow using esql code in MB6.1

Post new topic  Reply to topic Goto page 1, 2  Next
 How to delay the Message Flow using esql code in MB6.1 « View previous topic :: View next topic » 
Author Message
Sunrise
PostPosted: Thu Jun 27, 2013 9:21 pm    Post subject: How to delay the Message Flow using esql code in MB6.1 Reply with quote

Newbie

Joined: 27 Jun 2013
Posts: 3

How to stop or delay the message flow for certain time (Eg: 5 minutes) using esql compute code, not using JavaCompute node.(I am Using MB 6.1). Appriciate your great help.

Thanks,
Ram
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jun 27, 2013 9:33 pm    Post subject: Reply with quote

Jedi Council

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

Welcome to the Forum

1) Are you aware that 6.1 goes out of service very shortly?
2) This question has been asked before
3) There is an old by actually relevant IBM Red-Book on the timer nodes that may help.

However, a word of caution.
Generally this is not a good idea.

If you have a genuine reason for wanting to delay the processing of something for that long then please share it with us. Then we can guide you towards the most appropriate solution.
_________________
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
Tibor
PostPosted: Fri Jun 28, 2013 1:17 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

You can try something like this:
Code:
DECLARE tStart TIMESTAMP CURRENT_TIMESTAMP;

X : WHILE (CURRENT_TIMESTAMP - tStart) < INTERVAL '5' SECONDS DO
END WHILE X;

...but it would be very CPU consuming and highly disapproved
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Jun 28, 2013 1:41 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

Do not tight loop - you will get (or should be) fired for doing that.

Use a MQGET node against an empty queue with a wait interval of the delay time required.

You can call this from ESQL using a propagate, if preferred.

Lateral thinking....
Back to top
View user's profile Send private message
Sunrise
PostPosted: Fri Jun 28, 2013 3:11 am    Post subject: Reply with quote

Newbie

Joined: 27 Jun 2013
Posts: 3

Thanks to replay for all.

According to my requirement I can't use the MQGet Node here.
Using esql code i need to stop the thread for 2 minutes at certain point and i need to execute the rest of the code after 2 minutes in the flow.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jun 28, 2013 3:16 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.

Sunrise wrote:
Thanks to replay for all.

According to my requirement I can't use the MQGet Node here.
.


Perhaps the requirement is wrong?
Does the person creating this requirement actually know even the basics of Message Broker?
Why do they want to delay processing anyway?

I posted a thread some time ago called 'And the Requirement is'. It might be worth reading.
_________________
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
rekarm01
PostPosted: Fri Jun 28, 2013 3:20 am    Post subject: Re: How to delay the Message Flow using esql code in MB6.1 Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Tibor wrote:
You can try something like this:
Code:
DECLARE tStart TIMESTAMP CURRENT_TIMESTAMP;

X : WHILE (CURRENT_TIMESTAMP - tStart) < INTERVAL '5' SECONDS DO
END WHILE X;

...but it would be very CPU consuming and highly disapproved

All calls to CURRENT_TIMESTAMP within the processing of one node are guaranteed to return the same value, so the loop may run a bit longer than expected.

Sunrise wrote:
Using esql code i need to stop the thread for 2 minutes at certain point and i need to execute the rest of the code in the flow.

For WMB 6.1, this is not possible with ESQL alone. Either upgrade to WMB 7.0 or later, or provide an external function, or use other nodes.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Jun 28, 2013 3:21 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

You don't understand.

In the ESQL code - code a propagate statement to a terminal name that is connected to a MQGET node.

Control will pass to that terminal - enter the MQGET node and wait for the interval time (2 mins in your case) set on that node (use an empty queue).

Then control will resume in the compute node - EXACTLY where it was before.

Read about the Propagate statement. It works synchronously.

This will work, trust me.

Just create a new output terminal (e.g called outwait) on the compute node and connect that terminal to a MQGET node.

Then call that terminal with propagate from the ESQL inside the compute node. It's like a subroutine call and effectively embeds the MQGET inside the compute node.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri Jun 28, 2013 3:43 am    Post subject: Reply with quote

Jedi Knight

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

Sunrise wrote:
Thanks to replay for all.

According to my requirement I can't use the MQGet Node here.
Using esql code i need to stop the thread for 2 minutes at certain point and i need to execute the rest of the code after 2 minutes in the flow.


Sounds like your manager is coming up with technical requirements. That is even a more disastrous idea than the requirement.

What's the point of waiting? What are you waiting for?

Also who is prohibiting you from using particular nodes? If a node provides needed functionality, why are you not allowed to use it?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER


Last edited by lancelotlinc on Fri Jun 28, 2013 4:09 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
zpat
PostPosted: Fri Jun 28, 2013 3:46 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

Code:

--- ESQL before the wait is here
PROPAGATE TO TERMINAL 'outwait' FINALIZE NONE DELETE NONE;
--- ESQL after the wait is here
Back to top
View user's profile Send private message
NealM
PostPosted: Fri Jun 28, 2013 6:13 am    Post subject: Reply with quote

Master

Joined: 22 Feb 2011
Posts: 230
Location: NC or Utah (depends)

As a couple folks have already suggested, the MQGet timeeout is an ideal way of doing a low cost (CPU-wise) flow delay. If the issue is not wanting to add a queue for this purpose (short sighted as the queue's name can easily distinguish its purpose), just use an already existing queue, preferably one with low activity, but make sure your "match" will be impossible to ever really occur.
Also, remember, if that flow is paused and it is a single instance, then any other messages expected to flow through will be delayed until the flow completes. Perhaps that is the intention.
Regarding folks questioning any requirements for a built in flow delay, I'm sure if a poll were taken they would find there are more than a few practitioners who have seen legitimate requirements for a variety of reasons.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Jun 28, 2013 6:21 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

There is an ESQL sleep function in WMB 7.

This was just a way to do something similar in WMB 6.1.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri Jun 28, 2013 6:45 am    Post subject: Reply with quote

Jedi Knight

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

NealM wrote:
Regarding folks questioning any requirements for a built in flow delay, I'm sure if a poll were taken they would find there are more than a few practitioners who have seen legitimate requirements for a variety of reasons.


The question is: what is being accomplished by delaying the flow with a Sleep (or eqv) and why is some other approach not considered ?

Also: what is the rationale for prohibiting the use of JCNs and MQGet nodes ?
_________________
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
zpat
PostPosted: Fri Jun 28, 2013 7:28 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

Message flows shouldn't wait.

Ideally a flow would terminate if it needs a response and the response would start another flow.

That way the message flow can handle the maximum amount of work. However when using protocols inferior to MQ (that is - all of them) it's not always possible to do this.

In which case look at parallelism, but generally any wait interval (or just waiting for a response synchronously) will introduce a limiting factor to throughput and/or cause latency.

Always keep waits short and bear in mind someone may want to stop the message flow, EG or the broker, you may hold that action up.
Back to top
View user's profile Send private message
Tibor
PostPosted: Sat Jun 29, 2013 4:30 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

zpat wrote:
Message flows shouldn't wait.

If your message flow was added enough multiple instances, your flow can wait. But not really effective...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to delay the Message Flow using esql code in MB6.1
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.