Chapter 26. JMS User's Guide

This chapter is provided for advanced JOnAS users concerned with JMS (Java Message Service).

As required by the J2EE v1.4 specification, application components (servlets and enterprise beans) can use JMS for Java messaging. Furthermore, applications can use Message-driven Beans (MDBs) for asynchronous EJB method invocation, as specified by the EJB 2.1 specification.

JOnAS supports the JMS 1.1 specification, which offers a domain-independent approach to programming the client application. Priot to JMS 1.1, client programming for point-to-point and publish/subscribe domains was achieved using similar, but separate, class hierarchies. With JMS 1.1, it is now possible to engage queues and topics in the same transaction.

Enterprise Bean providers can use JMS connection factory resources via resource references, and JMS destination resources (JMS queues and JMS topics) via resource environment references. Thus, they are able to provide JMS code, inside an EJB method or web component method, for sending or synchronously receiving messages to/from a JMS queue or topic.

The EJB container and the Web container can allow for JMS operations within a global transaction, which may include other resources such as databases.

JOnAS integrates a third-party JMS implementation, JORAM (http://joram.objectweb.org/), which is the default JMS service, and for which a J2EE1.4 compliant Resource Adapter archive file is also provided. Other JMS providers, such as SwiftMQ (http://www.swiftmq.com/) and WebSphere MQ (http://www-3.ibm.com/software/integration/mqfamily/), can easily be integrated.

A JMS provider can be integrated within JOnAS by deploying a corresponding resource adapter. This is the preferred method as the JMS service will eventually become deprecated in future JOnAS releases. Also, this method allows deployment of 2.1 MDBs (which is impossible with the JMS service).

To perform JMS operations, application components use JMS-administered objects such as connection factories and destinations. Refer to Section 26.4 JMS Administration for an explanation of how to create those objects.

26.1. JMS is Pre-installed and Configured

To use JMS with JOnAS, no additional installation or configuration operations are required. JOnAS contains:

Additionally, another JMS implementation, the SwiftMQ product, has been used with JOnAS.