Setting expiration time on ESB message.
Issue
The problem is that messages that times out from any of our integration services will not be removed from the reply queue. We are using a JMSCourier to retrieve the messages. When the ESB receiving JMSCourier times out the return messages will still be returned to the reply queue but the receiving JMSCourier does not exist (it has timed out). The message will still be in a waiting state in the queue. The idea was to set a expiration timer on each message and then remove it to the dead letter queue with a HornetQ reaper but It seems that the expiration timer doesn't get added to the message.
The method inside our MessageHandler for sending messages looks like this.
public JMSEpr sendAndSetReplyQueue(Message message, List
// Message expire time
Long ttl = new Long(10000);
JMSEpr send_request_to = null;
JmsCourier courier = null;
String transactionId = ((ICommonMessage) message.getBody().get()).getHeader().getTransactionId();
JMSEpr getReplyFrom = new JMSEpr(JMSEpr.QUEUE_TYPE, replyQueue, MessageHandler.connection, environment,
"transactionId = '" + transactionId + "'");
message.getHeader().getCall().setReplyTo(getReplyFrom);
for (String queueName : queueNames) {
try {
send_request_to = new JMSEpr(JMSEpr.QUEUE_TYPE, queueName, MessageHandler.connection);
courier = new JmsCourier(send_request_to, false);
message.getProperties().setProperty(JMSPropertiesSetter.JMS_EXPIRATION, ttl);
courier.deliver(message);
} catch (Exception e) {
log.error(e);
} finally {
courier.cleanup();
}
}
return getReplyFrom;
}
Environment
5.3.1
Red Hat JBoss SOA Platform
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.