EJB programming & troubleshooting: Create a JMS message but deliver it in the future.

  1. Hi All, I am new to this forum. I Hope that I can get a solution to the problem that is bugging me for a long time. I am using JBoss the application server and using the default JMS service provided by it. I need a mechanism where a JMS message can be created instantly as required but delivered in the future. I mean I will create a JMS message and must be able to specify the exact amount of time after which it has to be delivered. Please note that the amount of time may vary depending on the content of the messsage. Can you please help me to take over this problem? Thank You, Kishore.

    Threaded Messages (2)

  2. Possible solution[ Go to top ]

    Delivery time may be useful for scheduling JMS messages. Unfortunately AFAIK there is no portable way to set delivery time for JMS messages. The following code shows how to schedule a JMS message for Weblogic and JBoss server: WebLogic version ... queueConnection = queueConnectionFactory.createQueueConnection(); QueueSession queueSession = queueConnection.createQueueSession(true, 0); QueueSender queueSender = queueSession.createSender(queue); ObjectMessage jmsMsg = queueSession.createObjectMessage(message); //Casts queueSender to weblogic.jms.extensions.WLMessageProducer interface and set delivery time ((WLMessageProducer) queueSender).setTimeToDeliver(timeToDeliver); queueSender.send(jmsMsg); ... }JBoss version ... //Setting JMS_JBOSS_SCHEDULED_DELIVERY message property jmsMsg.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", timeToDeliver); queueSender.send(jmsMsg); ... } Hope it helps.
  3. Another Possible solution[ Go to top ]

    If your application server is other than weblogic and jboss then you can use of EJB Timers to schedule ur message delivery.