JMS 2.0 Proposed Final Draft
JMS 2.0 has now been released. This page is retained here as a historical record. See also the JMS 2.0 Final Release page.
The JMS 2.0 Proposed Final Draft was published on 26 Febuary 2013. The specification and API documentation may be downloaded from the JCP website here.
What’s new in JMS 2.0?
A full list of the new features, changes and clarifications introduced in JMS 2.0 is given in the specification. See section B.5 “Version 2.0” of the “Change history” appendix. Here is a summary:
The JMS 2.0 specification now requires JMS providers to implement both P2P and Pub-Sub.
The following new messaging features have been added in JMS 2.0:
- Delivery delay: a message producer can now specify that a message must not be delivered until after a specified time interval.
- New send methods have been added to allow an application to send messages asynchronously.
- JMS providers must now set the JMSXDeliveryCount message property.
The following change has been made to aid scalability:
- Applications are now permitted to create multiple consumers on the same durable or non-durable topic subscription. In previous versions of JMS only a single consumer was permitted.
Several changes have been made to the JMS API to make it simpler and easier to use:
Sessionand other objects with a
closemethod now implement the
java.jang.AutoCloseableinterface to allow them to be used in a Java SE 7 try-with-resources statement.
- A new “simplified API” has been added which offers a simpler alternative to the standard API, especially in Java EE applications.
- New methods have been added to create a session without the need to supply redundant arguments.
- Although setting client ID remains mandatory when creating an unshared durable subscription, it is optional when creating a shared durable subscription.
- A new method
getBodyhas been added to allow an application to extract the body directly from a Message without the need to cast it first to an appropriate subtype.
A new chapter has been added which describes some additional restrictions and behaviour which apply when using the JMS API in the Java EE web or EJB container. This information was previously only available in the EJB and Java EE platform specifications.
A new chapter has been added which defines a number of standard configuration properties for JMS message-driven beans.
New methods have been added to
Session which return a
MessageConsumer on a durable topic subscription. Applications could previously only obtain a domain-specific
TopicSubscriber, even though its use was discouraged.
The specification has been clarified in various places.
JMS 2.0 demonstration examples
This demonstration (which has been updated to work with GlassFish build 82 (glassfish-4.0-b82-03_22_2013) shows
- Use of the JMS 2.0 simplified API using application-managed
- Use of the JMS 2.0 API using Java EE container-managed (injected)
- Use of the new
receiveBodymethod to synchronously receive a message and return its body in a single method call
- Use of the new
getBodymethod to return the body of a
Messagewithout the need to cast it to a more specific message type