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 » time delay in broker

Post new topic  Reply to topic
 time delay in broker « View previous topic :: View next topic » 
Author Message
guest468
PostPosted: Thu Apr 09, 2009 12:08 pm    Post subject: time delay in broker Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

Hi,
I have a requirement where in every message should be delayed for 5 minutes before sending it to output queue. So I can't introduce a flat delay from inside of the flow since that will result in accumulated delay affect on other messages. The message needs to be delayed from the time it arrived in the input queue. Is there anyway to achieve this using timer nodes


Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 09, 2009 12:19 pm    Post subject: Re: time delay in broker Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

guest468 wrote:
Is there anyway to achieve this using timer nodes
Thanks


Yes.

It's a terrible requirement, but it's dead easy to do with the Timeout nodes.

http://www.ibm.com/developerworks/websphere/library/techarticles/0603_schutz/0603_schutz.html
Back to top
View user's profile Send private message
guest468
PostPosted: Thu Apr 09, 2009 12:33 pm    Post subject: Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

Hi Jeff,
I was reading that article, but don't see an option to delay individual messages based on the message put date.
The flat delay that is discussed in option 5 is applied to first message only.
But the subsequent messages will have lower delay; based on how late they arrived on the queue in that batch.
can this can be set based on when the message arrived on the queue?

Thanks.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 09, 2009 12:35 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Scenario 5.
Back to top
View user's profile Send private message
guest468
PostPosted: Thu Apr 09, 2009 12:58 pm    Post subject: Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

I guess I will have to get the put date/time from the message MQMD and work with the current time stamp to compute the starttime.
Or is there any easier way? (doing arithmatic with timestamp would be painfull; that's why i am asking)
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 09, 2009 1:52 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

doing arithmatic with timestamps in broker is easy.

Set NewTime = CURRENT_TIMESTAMP + INTERVAL 5 MINUTE;
Back to top
View user's profile Send private message
guest468
PostPosted: Thu Apr 09, 2009 6:31 pm    Post subject: Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

Jeff,
that will work for the first message. But let's say 2nd message arrived after 2 minute. In this case the 2nd message will have a delay of 3 minutes only.

I was trying to get the puttime from MQMD and subtract it from current time and then subtract the result from 5 minutes. But 'INTERVAL' apparently accepts only string constants. Anyway even if i get this to work the code will not work around midnight where currenttime - puttime will will be a negative number. To avoid this I will have to club putdate with puttime into a timestamp value and work with current timestamp. I am not sure if i can club time and date in the first place.

So this is noway going to be a simple solution.
Thanks.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Apr 09, 2009 10:51 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.

Convert the MQ Date/Time into a timestamp and the maths is as before but using your value instead of CURRENT_TIMESTAMP

However,
The MQ Date/Time values are when the Message was put onto its first queue manager. This may NOT be the time it arrives on the message flow input queue.

If I were doing this (and I'm glad I'm not as it is a horrible requirement) I'd write the messages as they get picked up from the input queue to a database.

Then I'd have a timernode run once every few seconds, check the DB to see if there was a message to be sent (ie after the 5 min delay) and send it.

Trying to do this all synchronously is a realy PITA. it if far better to decouple the output from the input.
_________________
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
mqjeff
PostPosted: Thu Apr 09, 2009 11:34 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Using the timeout nodes is not really doing this "synchronously".

The performance characteristics of using a database may be significantly better than using Lots and Lots of TimoutControl based timers.

Using MQRO_EXPIRATION_WITH_FULL_DATA may be simpler and better performant than either option.

The mysteries of the CAST function and Intervals and formatting dates and times are left as an exercise.
Back to top
View user's profile Send private message
guest468
PostPosted: Fri Apr 10, 2009 9:45 am    Post subject: Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

Thanks guys,
And is there anyway to pass a variable to INTERVAL?
I can compute the required delay in seconds but I am unable to find any way to subtract this from currenttimestamp.

Thanks.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 10, 2009 9:52 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm sorry, I'm really confused.

You need the processing of one message to affect the processing of the other message? Are you trying to "collect" messages?
Back to top
View user's profile Send private message
guest468
PostPosted: Fri Apr 10, 2009 11:48 am    Post subject: Reply with quote

Centurion

Joined: 30 May 2006
Posts: 146
Location: NY

Guys,
I finally got it to work.
Thanks for the help.
Back to top
View user's profile Send private message
ydsk
PostPosted: Sat Apr 11, 2009 11:36 am    Post subject: Reply with quote

Chevalier

Joined: 23 May 2005
Posts: 410

Using an MQGet node with a wait time of 5 minutes in this case, and then connecting the NoMsg terminal for further processing would be a very good technique for delayed processing.

It may not be a straight forward way of doing things, but it works very well.

thanks
ydsk
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Apr 11, 2009 9:09 pm    Post subject: Reply with quote

Grand High Poobah

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

ydsk wrote:
Using an MQGet node with a wait time of 5 minutes in this case, and then connecting the NoMsg terminal for further processing would be a very good technique for delayed processing.

It may not be a straight forward way of doing things, but it works very well.

thanks
ydsk

Quite a nice idea, waiting 5 minutes on a message that will never come. However you would need to be able to make the wait time be dynamic. If you wait 5 mins for the 1st message maybe you'll only have to wait 500 ms for the next one. You don't want to wait 5 mins for the 1st message and 5 mins for the 2nd one if it came 500 ms after the first one... You really want to wait until message puttime + interval 5 mins....
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » time delay in broker
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.