-
1. Re: Artificially delaying messages
hargitt Nov 3, 2005 4:44 AM (in response to hargitt)Maybe a better way to view this questions is:
Is there a way to schedule the delivery of a message? For example, can you insert a message in a queue and say, delivery to the consumer after 2 hours?
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). This 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! -
3. Re: Artificially delaying messages
hargitt Nov 3, 2005 9:10 AM (in response to hargitt)I find no information regarding delaying messages in a queue in the FQA.
From what I have studied, time-to-live regards how long the message will exist in the queue, not how long the message must stay in the queue. -
4. Re: Artificially delaying messages
hargitt Nov 4, 2005 5:15 AM (in response to hargitt)So I guess a JMS or JBossMQ 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. -
5. Re: Artificially delaying messages
schrouf Nov 4, 2005 6:19 AM (in response to hargitt)Use JBoss specific scheduled delivery
aConnection = rQueueFactory.createQueueConnection(sQueueUser, sQueuePassword); aSession = aConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE); aSender = aSession.createSender(rQueue); TextMessage aMessage = aSession.createTextMessage(); aMessage.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", aTransmissionNext.getTime()); aSender.send( aMessage, DeliveryMode.PERSISTENT, ...);
Regards
Ulf -
6. Re: Artificially delaying messages
hargitt Nov 4, 2005 10:28 AM (in response to hargitt)Thank you very much! Somehow missed it in the doc.
-
7. Re: Artificially delaying messages
hargitt Nov 4, 2005 12:40 PM (in response to hargitt)Actually, I looked for it in doc and did not find any mention of JMS_JBOSS_SCHEDULED_DELIVERY. I have only found reference to it in the SpyMessage JavaDoc (I could not guess to look there) and one topic in this forum plus some other odd places on the net.
I think that an amendment to the JBoss administration guide would be useful. -
8. Re: Artificially delaying messages
alexdorand Nov 6, 2005 10:33 PM (in response to hargitt)There is one thing I suggest you do after delaying.
Create a test class that sends messages every 2 hours and make sure you are not getting this error message:org.jboss.mq.SpyJMSException: Exiting on IOE; - nested throwable: (java.io.EOFException) at org.jboss.mq.Connection.asynchFailure(Connection.java:436) at org.jboss.mq.il.uil2.UILClientILService.asynchFailure(UILClientILService.java:145) at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleStop(SocketManager.java:406) at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:338) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2603) at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845) at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:285) ... 1 more
Jboss has awkward reactions to delayed messages.