users@jms-spec.java.net

[jms-spec users] JMS 2.0: enhancement request: more flexible acknowledgment modes

From: Chris Barrow <chris.barrow_at_kaazing.com>
Date: Wed, 27 Jun 2012 22:36:56 -0700
Hi all,

Currently the JMS 1.1 and 2.0 specifications only allow for one mode of operation for applications which wish to do their own message acknowledgment. This is CLIENT_ACKNOWLEDGE mode. This mode has the following characteristic, as defined in the spec: "Acknowledging a consumed message automatically acknowledges the receipt of all messages that have been delivered by its session.".

This Implicit acknowledgment of all messages is not only confusing, it is highly inconvenient in cases where message processing is being done by multiple threads asynchronously. I realise this can be overcome to some degree by using multiple MessageConsumers on separate Sessions, but that imposes more of an overhead on the JMS provider. A better alternative, which is already offered by certain JMS providers (including Tibco EMS and ActiveMQ), is INDIVIDUAL_ACKNOWLEDGE mode, where acknowledging a message acknowledges only that message. This makes multithreaded or asynchronous processing of messages much easier to implement.

One can imagine other acknowledge modes that could be useful too, for example: CONSUMER_ACKNOWLEDGE where Message.acknowledge() would acknowledge only messages received up on a particular MessageConsumer, or CONSUMER_CHECKPOINT_ACKNOWLEDGE where Message.acknowledge() would acknowledge only messages received up to and including the Message instance on which the method was called.

Without embarking on all these various different possibilities, would it be possible to consider just adding INDIVIDUAL_ACKNOWLEDGE mode? This alone would make it possible for multithreaded applications to achieve whatever behaviors they need.

thanks,
Chris Barrow