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 » IBM MQ Java / JMS » How to delay the delivery of messages in MQ

Post new topic  Reply to topic
 How to delay the delivery of messages in MQ « View previous topic :: View next topic » 
Author Message
vatsanc
PostPosted: Fri Sep 08, 2006 2:00 pm    Post subject: How to delay the delivery of messages in MQ Reply with quote

Newbie

Joined: 27 Jun 2006
Posts: 6

Is there a way in Websphere MQ - either on the server side or in the API - to set a time delay in delivery of messages put on a queue ? The business requirement is as follows:
There are 2 tiers of customers: tier-1 and tier2. Every customer has a dedicated queue. The tier-1 customers get the messages immediately after the message is put on their queues. The tier-2 customers are beta customers that should get the message after a delay. Its the same application that puts the message out on all the queues. Whats the most elegant way to implement this delayed delivery requirement ?

Thanks
Back to top
View user's profile Send private message
wschutz
PostPosted: Fri Sep 08, 2006 2:49 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Well, there is no way to delay putting a message on a queue, but you can delay taking messages off queues.... how were you planning on servicing T1 customers? Triggering?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Fri Sep 08, 2006 2:56 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There are several bad ways of accomplishing what you want.

One is to implement logic in your code that delays committing messages intended for tier-2 customers. This will fairly rapidly fill up both your uncomitted message count, AND your log files. So it's quite a beaut.

Another is to misuse expiry, and expiry-report-with-full-data. If you put all yoru tier2 messages to a queue that is only browsed, with a suitable expiration time on the messages, then when the message expires, a different copy will get put onto the "replytoqueue" of the message - which could be your tier2 partner's input queue. Then they'd have to be prepared to receive messages that were Report messages, rather than Datagrams.

A third way is to edit the mirrorq API exit, or some other API exit, such that it can tell if a message belongs to tier1 or tier2 and will "delay" it if it belongs to tier2.

A fourth way is to misuse message priority, and some kind of intermediary queue that has a process that will immediately forward high priority messages in favor of low priority messages.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
scooper750
PostPosted: Thu Sep 21, 2006 4:04 am    Post subject: Question Reply with quote

Newbie

Joined: 20 Sep 2006
Posts: 2

Jeff, have a question about the misuse of expiry in particular. Are you using the setJMSExpiry... or setTimeToLive. I've actually tried both with no luck. In my case, setJMSExpiration had no effect (as expected according to the documentation). Expiry set to 0 for unlimited when I look at the messages in the queue. As for timeToLive, that worked as far as removing the message from the queue when the timeToLive expires, but it never sends a reply to the queue that I specified in setJMSReplyTo.

Basically, for my scenario this is what I need.
I've got messages being put on Queue 1 that is being picked up by an MDB and processed. While processing if resources are unavailable (on the host in my case - VSAM files, etc), I want to take that input object to the Queue 1 MDB, place it on Queue B (which is read only and has no consumers) with an expiry and a replyTo of Queue 1 so that the input will retry in X hrs or minutes. Theoretically should work great, but I must be missing something.

The EJB 2.1 spec has exactly what I need (TimerService), but since we're running EJB 2.0 i'm S.O.L. Any input would be appreciated.


Last edited by scooper750 on Thu Sep 21, 2006 4:16 am; edited 1 time in total
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Sep 21, 2006 4:14 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Did you set:
MQRO_EXPIRATION or
MQRO_EXPIRATION_WITH_DATA or
MQRO_EXPIRATION_WITH_FULL_DATA

also, you do not that report messages are only produced when the message expires... which might not be exactly when you think it should be ....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
scooper750
PostPosted: Thu Sep 21, 2006 4:21 am    Post subject: Reply with quote

Newbie

Joined: 20 Sep 2006
Posts: 2

I didn't see any methods that would set that. Is that an option on the message level or on the QueueSender level. Using javax.jms.ObjectMessage and javax.jms.QueueSender.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 21, 2006 4:28 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/csqzaw1481.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Fri Sep 22, 2006 6:47 am    Post subject: Reply with quote

Guest




Is there anything in the application data portion of the message that identifies it as tier1 or tier2? (Or can the putting application insert tierx in an unused field in the MD?)

Since put time is in the MQMD, your application could get the message, look at the tierx and put time; then suspend itself (wait) for whatever period of time you want.

This method would have little impact on MQ's workload.
Back to top
jefflowrey
PostPosted: Fri Sep 22, 2006 6:52 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Bruce, yes. That's a good way of solving this problem.

But it's not in the MQ API or the Server configuration, as the original poster asked about.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
chv_v
PostPosted: Sat Sep 23, 2006 12:45 pm    Post subject: Reply with quote

Newbie

Joined: 01 Feb 2005
Posts: 9

How can we delay taking messages off from queues.

I am working on Broker V5

thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sat Sep 23, 2006 2:46 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

chv_v wrote:
How can we delay taking messages off from queues.

I am working on Broker V5

thanks


You can't in Broker v5.

Not at a per-message level, at least.

In v6, you could wire in some Timeout* nodes and maybe an MQGet.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Sep 23, 2006 10:34 pm    Post subject: Reply with quote

Grand High Poobah

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

chv_v wrote:
How can we delay taking messages off from queues.

I am working on Broker V5

thanks


And as mentioned previously unless you are under some imperative you cannot change, challenge the design. Messages are built to flow. Trying to delay them is against the patterns and design.
_________________
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 » IBM MQ Java / JMS » How to delay the delivery of messages in MQ
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.