0
votes

The JMS specification and the subtle differences between different brokers are driving me crazy.

Right now I've implemented a simple system that reads one message at a time off a JMS queue and does something with it. Where 'it' requires a network operation that might fail from time to time.

My current implementation is based around opening a non transacted JMS session with client acknowledge mode. When processing of a messages is successful I call acknowledge, and when it's not I just close the session.

Is this the best way to implement this? What about re-delivery policies? From what I can tell right now this seems to be handled differently in each and every JMS broker implementations (which sucks because I have to deal with two different implementations).

I would greatly appreciate any help!

1

1 Answers

0
votes

Is this the best way to implement this?

There is a problem to keep messages not acked: message can be continuously redelivered. Try to start with basic strategy - auto acknowledge and transact session.

What about re-delivery policies

In case of failure just throw an exception in listener and configure dead letter queue (DLQ) in a broker. After failure let broker put message to DLQ. Later you can manually drop this messages or queue them for redelivery, but usually it is manual procedure.