Pragmatically set up JMS retry strategy in JBoss

JBoss uses so called "Dead Letter Queue" to handle undeliverable JMS message. It can be configured with "conf/standardjboss.xml".

In times though, you may want finer control over JMS retry strategy. By setting JBoss specific properties before sending message, you can pragmatically override how undeliverable JMS message is handled.

  • JMS_JBOSS_SCHEDULED_DELIVERY : scheduled time for message delivery
  • JMS_JBOSS_REDELIVERY_DELAY : delay between retry in milli-seconds
  • JMS_JBOSS_REDELIVERY_COUNT : count of retry
  • JMS_JBOSS_REDELIVERY_LIMIT : max number of retry attempt

TextMessage outMessage= topicSession.createTextMessage(outString);
            
outMessage.setLongProperty("JMS_JBOSS_REDELIVERY_DELAY", 10000);

outMessage.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", 
    deliveryDate.getTime());

topicPublisher.publish(outMessage);  

Technorati Tags:

Comments

Anonymous said…
Thanks, solved a problem I was having
Bortx said…
me too, thanks a lot
Anonymous said…
thanks dude....precise information.

Popular Posts