Message Service simplified

JMS 2.0 simplified code appears for Java EE 7 Early Draft

Chris Mayer

Long overdue a makeover, Java Message Service (JSR 343) is getting some serious renovation to bring it up to the level of other features for Java EE 7.

We’ve been following the progress of Java EE 7’s renovated specifications eagerly, as the plans for the next major Java enterprise release fall into place with Early Drafts giving us a glimpse at its potential.

So far, JPA 2.1JAX-RS 2.0EJB 3.2JavaServer Faces 2, and CDI 1.1 have all released previews, but we’ve not heard much about JMS 2.0. Until now. Java EE Evangelist Arun Gupta told reveals in his recent post more about the plans for Java Message Service, which admittedly has been long neglected as a specification, gathering dust on the back of the EE shelf.

With Message Oriented Middleware products becoming essential for most enterprises, the time for a simpler and flexible JMS system is now. Although, it’s accepted that trying to unite all the existing JMS implementations under one Java EE roof would prove unneccessarily complicated.

JMS 1.1 first appeared back in December 2003, way back in the days of Java EE having the moniker J2EE 1.4, and it’s fair to say the landscape is completely unrecognisable from what it was nearly a decade ago. As Gupta notes with things like ‘annotations, generics, auto-closeable, dependency injection’, Java’s a much more defined beast these days.

Taking all this onboard, Gupta explains the main goals for JMS 2.0:

  • Changes to improve ease of development
  • Clarification of relationship between the JMS and other Java EE specifications
  • Definition of a new mandatory API to allow any JMS provider to be integrated with any Java EE application server
  • Extensions to support Java EE 7
  • Other enhancements as requested by the community

So basically, starting from the foundations up to freshen up an integral part of the enterprise platform. Gupta also revealed how the new API would radically simplify matters when using JMS:

@Resource(lookup = "jms/connectionFactory")
ConnectionFactory connectionFactory;

Queue inboundQueue;

public void sendMessageNew (String payload) {
try (JMSContext context = connectionFactory.createContext();){

That simple. All the superfluous boilerplate code has gone, with creating a context and invoking from ConnectionFactory now the preferred way of doing things. New methods throw runtime exception so the code looks much cleaner as well.

Gupta’s post on the JMS 2.0 Early Draft reveals just how much has been done towards upcycling a piece of Java EE furniture, which isn’t exactly a bad thing when you could do this in Spring since 2007. We’re happy that Oracle are finally recognising the vital need for a much more synchronous messaging system.

Check out the JMS 2.0 API draft here, as well as monitoring its progress by joining the mailing list at [email protected]. The full release for Java EE 7 is expected at the end of 2013, so plenty of time yet to get your thoughts across.

The Expression Language 3.0 Early Draft has just surfaced as well, with plans to separate ELContext into parsing and evaluation contexts and add integration with CDI such as generating events before/during/after the expressions are evaluated. There’s still much to do for Java EE 7, but these Early Draft are reassuring that Oracle is working hard towards fleshing out a full version.

Inline Feedbacks
View all comments