Supported communication types on Java EE and Jakarta EE platforms
On the Java EE and Jakarta EE platforms, IBM® MQ classes for JMS and IBM MQ classes for Jakarta Messaging support two types of communication between a component of an application and an IBM MQ queue manager.
IBM MQ 9.3.0 introduced support for Jakarta Messaging 3.0. JMS 2.0 is still fully supported. Because JMS and Jakarta Messaging share much in common, further references to JMS in this topic can be taken as referring to both. Any differences are highlighted as necessary.
- Outbound communication
- Inbound communication
Outbound communication
Using the JMS or Jakarta Messaging API directly, an application component creates a connection to a queue manager, and then sends and receives messages.
For example, the application component can be an application client, a servlet, a Java Server Page (JSP), an enterprise Java bean (EJB), or a message driven bean (MDB). In this type of communication, the application server container provides only low-level functions in support of messaging operations, such as connection pooling and thread management.
Inbound communication
In the case of inbound communication, a message arriving at a destination is delivered to an MDB, which then processes the message.
Java EE and Jakarta EE applications use MDBs to process messages asynchronously. An MDB acts as a JMS message listener and is implemented by an onMessage() method, which defines how a message is processed. An MDB is deployed in the EJB container of an application server. The precise way in which an MDB is configured depends on which application server you are using, but the configuration information must specify which queue manager to connect to, how to connect to the queue manager, which destination to monitor for messages, and the transactional behavior of the MDB. This information is then used by the EJB container. When a message satisfying the selection criteria of the MDB arrives at the specified destination, the EJB container uses IBM MQ classes for JMS or IBM MQ classes for Jakarta Messaging to retrieve the message from the queue manager, and then delivers the message to the MDB by calling its onMessage() method.