I am using JMS Queue, and MDB which listen to it. I have a retry mechanism, so when exception is being thrown a rollback to the transaction will occur and the operation will re-executed/
I would like to achieve the Message_retry_number, each time "onMessage" being executed, so I can write the current execution retry number. I heard I can retrieve it through the Header of the message object, but couldn't find anything in the properties or in the net.
anyone has any clue?
Thanks, ray.
The parameter destination is a Queue or Topic object that the application has created previously. The application then uses the receive() method of the MessageConsumer object to receive a message from the destination, as shown in the following example: Message inMessage = consumer. receive(1000);
JMS supports two different message delivery models: Point-to-Point (Queue destination): In this model, a message is delivered from a producer to one consumer. The messages are delivered to the destination, which is a queue, and then delivered to one of the consumers registered for the queue.
JMS (Java Message Service) is an API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication. JMS is also known as a messaging service.
JMS defines six message interface types; a base message type and five subtypes.
See javax.jms.Message.getIntProperty. Property name is "JMSXDeliveryCount".
The only standard way to do this is be having a look at the JMSXDeliveryCount property. However you should be aware that the JMS specification states that JMS defined properties (those starting with JMSX) are optional - so it depends on your specific provider whether this property is supported, and set in every case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With