jsr343-experts@jms-spec.java.net

[jsr343-experts] (JMS_SPEC-43) New API to send a message with async acknowledgement from server

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Fri, 05 Aug 2011 17:35:28 +0100

I have logged this JIRA issue:
http://java.net/jira/browse/JMS_SPEC-43

This issue was raised by Clebert, though the wording below is my own. It was also mentioned in Tom's longer list of
proposals.

Comments, please!

------------------

This is a proposal for a new API which will send a message and return immediately without blocking until an
acknowledgement has been received from the server. Instead, when the acknowledgement is received, an asynchronous
callback will be invoked.

Here is a suggested API:

There would be a new method on {{javax.jms.MessageProducer}}:

public void setAcknowledgeListener(AcknowledgeListener listener);

This would change the behaviour of any subsequent call to any of the four {{send}} methods so that they would return
without blocking until an acknowledgement has been received from the server. When the acknowledgement is received, the
callback method on the {{AcknowledgeListener}} is received.

This feature will only be available for non-transacted sessions. if {{setAcknowledgeListener}} was called on a
transacted session then a {{javax.jms.IllegalStateException}} would be thrown.

package javax.jms;
import javax.jms.Message;

public interface AcknowledgeListener {
        public void onAcknowledge(Message message);
}

------------------