This is a follow-up to my proposals to change the API for consuming messages asynchronously using the simplified API,
which I circulated on 15th March. I received one +1 and no other comments.
I have now gone ahead and drafted the required changes to the API and spec.
Just to remind you, this change abandons the ability to set a message listener directly on a MessagingContext (as being
too complicated despite being limited in functionality) and instead changes to an API style similar to the standard API,
where the application needs to create a consumer object first and then set the message listener on that.
The updated API and Javadocs are here:
http://java.net/projects/jms-spec/sources/repository/content/jms2.0/target/jms-2.0-javadoc.jar
The updated draft spec is here:
http://java.net/projects/jms-spec/sources/repository/content/jms2.0/specification/word/JMS20.pdf
As proposed, the new combined consumer object (for sync and async delivery) is called JMSConsumer
For reasons of consistency, MessagingContext has been renamed JMSConsumer
Here's a summary of the changes. Note that this removes 10 methods from MessagingContext (and adds 4 methods to
JMSConsumer in exchange).
API and Javadoc changes
-----------------------
Changes to SyncMessageConsumer
Renamed to JMSConsumer
New method getMessageListener added
New method setmessageListener added
New method getBatchMessageListener added
New method setBatchMessageListener added
Changes to MessagingContext
Renamed to JMSContext
Existing method createSyncConsumer (3 methods) renamed to createConsumer
Existing method createSyncDurableConsumer (2 methods) renamed to createDurableConsumer
Existing method setmessageListener (5 methods) deleted
Existing method setBatchMessageListener (5 methods) deleted
Existing method createMessagingContext renamed to createContext
Changes to ConnectionFactory
Existing method {{createMessagingContext (4 methods) renamed to createContext
Spec changes
------------
Section 11.2.4 "Consuming messages asynchronously" has been completely deleted.
Section 11.2.5 "Consuming messages synchronously" has been renamed 11.2.4 "Consuming messages" and updated to cover
async message delivery as well.
Following the deletion of the section mentioned above, sections 11.2.6, 11.2.7, 11.2.8 and 11.2.9 become 11.2.5, 11.2.6,
11.2.7 and 11.2.8.
In section A.2 "Unresolved issues in the JMS 2.0 Early Draft", subsection A.2.1 "Simplified JMS API: Support for
multiple consumers on a session" has been deleted since this issue has now been resolved.
References to MessagingContext have been changed to JMSContext throughout
References to SyncMessageConsumer have been changed to JMSConsumer throughout
Section 11.4. "Examples using the simplified API" has been updated to reflect these API changes.
Note that the spec does not attempt to record the changes between the Early Draft and this version, since this would be
too complicated.
Nigel