Using IBM MQ classes for JMS in a CICS Liberty JVM server

Java™ programs running in a CICS® Liberty JVM server can use JMS to access IBM® MQ. When the IBM MQ JMS feature is installed in a CICS Liberty JVM server, JMS requests are processed by the MQ messaging provider. Support for the JMS 2.0 feature gives access to the classic (JMS 1.1) and simplified (JMS 2.0) interfaces. CICS must be connected to a level of IBM MQ queue manager that supports the appropriate level of JMS and is using a suitable version of the IBM MQ classes for JMS.

For an introduction, see How it works: IBM MQ classes for JMS. For information about how IBM MQ implements JMS, see Using IBM MQ classes for JMS in the IBM MQ documentation, including IBM MQ classes for JMS JavaDoc and information about messages, application functions, and accessing MQ features in Writing IBM MQ classes for JMS applications. To compare levels of JMS specification, see Java Message Service Specification.

In a CICS Liberty environment, the IBM MQ messaging provider supports JMS connections to be made to an IBM MQ queue manager as follows:
  • In a CICS integrated-mode Liberty JVM server, JMS applications can only connect to a queue manager using MQ client mode transport. The use of MQ bindings mode is not supported. This type of CICS Liberty JVM server provides JMS support, with integrated CICS transactions and security.
  • In a CICS standard-mode Liberty JVM server, JMS applications can connect to a queue manager using either MQ bindings mode or client mode transports. This type of CICS Liberty JVM server provides JMS support, without integrated CICS transactions.
Your Java application communicates with IBM MQ in one of two ways:
  • Through message-driven beans (MDBs)
  • Through a servlet that uses a JMS connection factory
Figure 1. Applications connecting to IBM MQ using JMS and running in a CICS Liberty JVM server. This picture shows the two types of programming that can be used to interact with IBM MQ from a CICS Liberty JVM server. The CICS Liberty JVM server shown is either CICS standard-mode or CICS integrated-mode. In addition to the MQ client mode connection that is shown, a CICS standard-mode Liberty JVM server can connect in bindings mode.
Image described in surrounding text

Things to check

  • Your intended connection to IBM MQ is supported by your version of the CICS Liberty JVM server. See Table 1 in Accessing IBM MQ from Java programs.
  • The level of JMS that is supported by the IBM MQ queue manager that CICS connects to. IBM MQ for z/OS® Version 7.1 only supports JMS 1.1. IBM MQ Version 8.0 and above support both JMS 1.1 and JMS 2.0.
  • If you use bindings mode transport (supported only by CICS standard-mode Liberty) :
    • JMS applications that connect to an IBM MQ queue manager using bindings mode must specify a different queue manager to the queue manager that is specified on any CICS MQCONN resource installed in the same CICS region.
    • Both Liberty and IBM MQ are deployed on the same server.
  • Any CICS tasks started using the CICSExecutorService must connect to a queue manager using client mode transport.
  • There are some programming restrictions, described in JMS programming considerations (Liberty JVM server).

Where next?

To use JMS in an application, you must:
  • Ensure that you have access to the IBM MQ classes for JMS in your development environment, either as a component of IBM MQ product or as a JAR file from FixCentral (see Using IBM MQ classes for JMS for information on how to do this.)
  • Develop your application to use either managed JMS connection factory or message-driven beans (MDBs). For more information, see Programming with IBM MQ classes for JMS with a Liberty JVM server.
  • Add your application to a CICS bundle project, export to zFS, and install it into the Liberty JVM server.
  • Configure the CICS Liberty JVM server environment. In addition to configuring the server.xml, you must set up the IBM MQ resource adapter, which is needed to connect to IBM MQ from Liberty. For more information, see Configuring a Liberty JVM server to support JMS.