Tuesday, July 5, 2011

WebLogic JMS, scheduling a JMS message for delivery in the future



NOTE: this setting can take place either on the Queue or on the Connection factory!

See also basic JMS Send Message code here
If we enrich that code with:

long timeToDeliver = 60000; // a minute from now
//Casts queueSender to weblogic.jms.extensions.WLMessageProducer interface and set delivery time
((WLMessageProducer) queueSender).setTimeToDeliver(timeToDeliver );

see here for javadoc

The message WILL appear in the queue, but with a state "delayed", a "Delivery Time" in the future and a property JMS_BEA_DeliveryTime with the future time.

- Man of the future - age: 500 years from now
- I tell you that I have seen in the street a man like this, alive!
- Absurd!

In OSB, the best thing is to have 2 Connection factories, each with a different Default Time To Deliver, and a different Business Service for immediate messages and delayed messages.

No comments: