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 » Scheduling message delivery

Post new topic  Reply to topic
 Scheduling message delivery « View previous topic :: View next topic » 
Author Message
hargitt
PostPosted: Thu Nov 03, 2005 3:31 am    Post subject: Scheduling message delivery Reply with quote

Newbie

Joined: 03 Nov 2005
Posts: 5

Is there a way to schedule the delivery of a message? For example, can you insert a message in a queue and have the consumer only pick it out exactly 2 hours after is was inserted?

I have searched around and I have not found any selector variable that can indicate the current time.

I was thinking of a selector like:
JMSTimestamp <currentTimeMillis - 60000

where currentTimeMillis is a variable replaced by the current system time in miliseconds (i.e. like sysdate in Oracle). In this example, the selector would schedule delivery of every message to consumers one minute after the message has been inserted in the queue.

Is there such a variable as currentTimeMillis? If not, I have to continually recreate the selector and update currentTimeMillis!

Maybe I am taking the wrong approach?
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Thu Nov 03, 2005 5:27 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

i do not know about jms selectors...... but there is no message scheduling in mqseries. once a message is given to mqseries, mq tries to deliver it. if the message is delivered and has reached its final destination, it is available for get.

the only thing that comes into my mind is - when using distributed queueing - to give the data to mqseries and have the channel stopped so the data is not delivered to other queuemanagers until the channel is started, but that is a really bad design. kids, dont try that at home! mq is no data store!

maybe the best thing is to schedule the program that puts the data to mqseries.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 03, 2005 5:28 am    Post subject: Reply with quote

Grand High Poobah

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

Totally wrong approach.

What are you trying to achieve? Why the delay?
Back to top
View user's profile Send private message Send e-mail
hargitt
PostPosted: Thu Nov 03, 2005 6:06 am    Post subject: Reply with quote

Newbie

Joined: 03 Nov 2005
Posts: 5

I need to implement the delay because the external system that provides me the message (I insert the message in the queue) can not deal with such a quick response.

Actually, we are processing messages that come from a mobile network. These are SMS messages. When a mobile phone sends an SMS to our system and requests a delivery receipt from the operator, the delivery receipt is returned to the mobile phone at the same time as we reply to the user's message.

A mobile phone can not receive two messages at the same time thus one of the two have to be delayed. By default, an operator will in average delay the second message anywhere from 5 to 15 minutes. Unfortunatly the delivery receipt is always the first message to reach the phone, thus users get back our reply with much delay. The experience for the user is like waiting 5 minutes for a web page to return... not very nice...

The simplest thing I can think of for creating a delay is via the JMS queues we use to queue incoming and outgoing traffic. If we can make sure each message inserted in the incoming queue only gets delivered to the consumer after 2-3 seconds, we will avoid the problem on the user's mobile phone.

A sleep is definatly not a solution as we may easily be processing 50 messages per second on average.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 03, 2005 6:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should use a database table for this.

In the following manner,
1) an SMS message arrives on your queue
2) Insert it into the database with the current timestamp
3) Select all messages older than 5 seconds from the database
4) send those messages in oldest first order
5) wait for the next message on your queue
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
hargitt
PostPosted: Thu Nov 03, 2005 6:33 am    Post subject: Reply with quote

Newbie

Joined: 03 Nov 2005
Posts: 5

meaning that there is no JMS solution for this?
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Nov 03, 2005 7:14 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You can certainly use JMS for steps 1, 4, 5 from Jeff's append.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
wschutz
PostPosted: Thu Nov 03, 2005 7:55 am    Post subject: Reply with quote

Jedi Knight

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

If you have MQ Brover V6 in the mix, you can easily use the new Timeout nodes to accomplish this.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Thu Nov 03, 2005 7:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

wschutz wrote:
If you have MQ Brover V6 in the mix, you can easily use the new Timeout nodes to accomplish this.


But it is certainly not worth buing and installing Broker v6 JUST for the timeout nodes.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
hargitt
PostPosted: Fri Nov 04, 2005 2:13 am    Post subject: Reply with quote

Newbie

Joined: 03 Nov 2005
Posts: 5

So I guess a JMS wish list for the selector is a CURRENT_TIME variable...

Safer to have a home made DB queue with a select that only pulls out messages that are older than x seconds.
Back to top
View user's profile Send private message
slm.ismail
PostPosted: Sun May 21, 2006 7:31 am    Post subject: Scheduling MQ Series Messages Reply with quote

Newbie

Joined: 21 May 2006
Posts: 3

Mr, Hergitt..
have you resolved the above mentioned issue? ( scheduling x mins to delivering the msgs ) ?
Back to top
View user's profile Send private message
hargitt
PostPosted: Sun May 21, 2006 11:52 pm    Post subject: Reply with quote

Newbie

Joined: 03 Nov 2005
Posts: 5

No.

I ended up using JBossMQ. They have a "non-standard" solution allowing you to set the delivery time of the message.

Example:
jmsMsg.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", message.getSendTime());
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 » IBM MQ Java / JMS » Scheduling message delivery
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.