-
1. Re: Delaying the delivery of message from the Queue to an MD
pixel Jun 8, 2005 4:12 AM (in response to dsn)If there is no in-built way has anyone managed to come up with an elegant solution. Everything we can come up with involves re-queuing and sleeping, which leaves something to be desired
-
2. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 8, 2005 5:04 AM (in response to dsn)The Boss specific scheduled message delivery feature might do the job:
aConnection = QueueFactory.createQueueConnection(sQueueUser, sQueuePassword); aSession = aConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE); aSender = aSession.createSender(rQueue); TextMessage aMessage = Session.createTextMessage(); .... aMessage.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", <your delivery time (current+delay)>); .... aSender.send(...); Regards Ulf
-
3. Re: Delaying the delivery of message from the Queue to an MD
pixel Jun 8, 2005 4:52 PM (in response to dsn)Thanks, that's great. It seems to do exactly what we need. Are there any overheads we should be aware of to this method?
-
4. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 8, 2005 4:58 PM (in response to dsn)no overhead. Just keep in mind that this is a JBoss specifc feature which might hinder a possible port to another app server (but hy should you :-)
Regards
Ulf -
5. Re: Delaying the delivery of message from the Queue to an MD
rubnix Jun 9, 2005 6:01 AM (in response to dsn)Hi all, i have seen this post and i have a question...
As you have a MDB associated to the queue... what happens if the server crash and there are still messages in the queue for processing?
i have a similar achitecture in my application and i have that problem... the messages are consumed because the queue configuration is deployed in the server before the MDB, so the messages in the queue are consumed and not processed by the MDB..
Did you have this problem?? Any soluction?
Regards
Rubnix -
6. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 9, 2005 8:51 AM (in response to dsn)A queue does not 'comsume' any messages by itself. Maybe you do not use persistent messages, so these in-memory-only messages get lost in case of a server crash.
Regards
Ulf -
7. Re: Delaying the delivery of message from the Queue to an MD
rubnix Jun 9, 2005 12:06 PM (in response to dsn)I have the files correspoding to the JMS stored in the folder for the queue,
/jboss/server/default/data/jbossmq/file/QUEUE.queue
The messages that werent consumed before the server crash are still stored in that folder... and after the restart, are "consumed" because the queue configuration file is deployed in JBoss before the MDB, so, the queue havent a destination to send the message, and consume it.. or that is what i understand... -
8. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 10, 2005 5:00 AM (in response to dsn)A queue is not an active comsumer, it's just a passiv data storage. Message consumation is always initiated by a JMS client via receive call.
The fact that there are unconsumed messages in the file store that do not get properly forwarded to your MDB (this is the active JMS receiver) might indicate a message restore to queue problem on server restart.
You should turn on log4j debug/trace output for the JBoss MQ subsystem (org.jboss.mq) and have a look into your server.log file on server startup. Check the log output for your queue deployment. There you should find some information - hopefully - about the actual count of restored messages.
BTW: Have your tried to use a JMS JDBC persistence manager configuration. This is much more reliable than usage of the file based JMS persistence manager.
Regards
Ulf -
9. Re: Delaying the delivery of message from the Queue to an MD
pixel Jun 10, 2005 5:35 AM (in response to dsn)Hi, could you confirm something for me please.
When I put a message on the queue with a 30 min delay, and restart the server during that period, the messages still get delivered. I am using persistent messages for all tests.
When I put another message on the queue with a 30 min delay, and restart the server so that it only comes back up after the 30 mins the messages do not get delivered.
This seems to make sense, the server is not delivering messages that have passed their delivery date, but I just want to confirm that this is the expected results, and if there is any way to prevent this. I don't want messages getting lost if the server is down when they are due to be delivered. I would rather they get sent late than not at all.
Thanks -
10. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 10, 2005 6:34 AM (in response to dsn)As there is no standard for scheduled message delivery, there is no real expected behaviour.
Nevertheless your observed behaviour (scheduled messages get dropped if server restarts after schedule time) does not make sense to me unless you set (explicitly or implicitly) a message expiration time (which i guess you don't do).
Therefore I would consider this behaviour - if it's reproducible - as a bug, but having a quick view at the source code of BasisQueue.restoreMessage() I do not see one :-)
Regards
Ulf -
11. Re: Delaying the delivery of message from the Queue to an MD
schrouf Jun 10, 2005 6:36 AM (in response to dsn)As there is no standard for scheduled message delivery, there is no real expected behaviour.
Nevertheless your observed behaviour (scheduled messages get dropped if server restarts after schedule time) does not make sense to me unless you set (explicitly or implicitly) a message expiration time (which i guess you don't do).
Therefore I would consider this behaviour - if it's reproducible - as a bug, but having a quick view at the source code of BasisQueue.restoreMessage() I do not see one :-)
Regards
Ulf -
12. Re: Delaying the delivery of message from the Queue to an MD
pixel Jun 10, 2005 11:19 AM (in response to dsn)I've replicated this using the all the default settings, changing the TimeToLive to unlimited(0) and to 2+ hours in the future, with the same results. I am using JBoss 3.2.7 if it makes any difference. I'll fill in a bug-report and see what happens, and have a dig around the source.
It's not the end of the world, I can implement something to deal with the problem easily enough, but if I don't have to then obviously I don't want to.
Thanks for your help with this anyway -
13. Re: Delaying the delivery of message from the Queue to an MD
genman Jun 14, 2005 5:43 PM (in response to dsn)
You can turn on debug on the server and see what it's doing.
There's also a count of the # of scheduled messages and you can verify it is the correct value after a restart.
I haven't had any problems with this feature like you describe... -
14. Re: Delaying the delivery of message from the Queue to an MD
pixel Jun 15, 2005 5:13 AM (in response to dsn)What version are you running? If it makes any difference I'm running 3.2.7
Is the message count in the logs, or in the web-console?
Thanks