Using IBM MQ classes for Java

IBM® MQ classes for Java enable you to use IBM MQ in a Java environment. IBM MQ classes for Java allow a Java application to connect to IBM MQ as an IBM MQ client, or connect directly to an IBM MQ queue manager.

Note: IBM MQ classes for Java are not supported in IMS.

IBM MQ classes for Java is one of two alternative APIs that Java applications can for use to access IBM MQ resources. The other API is IBM MQ classes for JMS.

From IBM MQ 8.0, the IBM MQ classes for Java are built with Java 7.

The Java 7 runtime environment supports running earlier class file versions.

IBM MQ classes for Java encapsulate the Message Queue Interface (MQI), the native IBM MQ API and use a similar object model to the C++ and .NET interfaces to IBM MQ.

Programmable options allow IBM MQ classes for Java to connect to IBM MQ in either of the following ways:
  • In client mode as an IBM MQ MQI client by using Transmission Control Protocol/Internet Protocol (TCP/IP)
  • In bindings mode, connecting directly to IBM MQ by using the Java Native Interface (JNI)
Note: Automatic client reconnection is not supported by IBM MQ classes for Java.

Client mode connection

An IBM MQ classes for Java application can connect to any supported queue manager by using client mode.

To connect to a queue manager in client mode, an IBM MQ classes for Java application can run on the same system on which the queue manager is running, or on a different system. In each case, IBM MQ classes for Java connects to the queue manager over TCP/IP.

For more information on how to write applications to use client mode connections, see IBM MQ classes for Java connection modes.

Bindings mode connection

When used in bindings mode, IBM MQ classes for Java uses the Java Native Interface (JNI) to call directly into the existing queue manager API, rather than communicating through a network. In most environments, connecting in bindings mode provides better performance for IBM MQ classes for Java applications than connecting in client mode, by avoiding the cost of TCP/IP communication.

Applications that use the IBM MQ classes for Java to connect in bindings mode must run on the same system as the queue manager to which they are connecting.

The Java Runtime Environment, that is being used to run the IBM MQ classes for Java application, must be configured to load the IBM MQ classes for Java libraries; see IBM MQ classes for Java libraries for further information.

For more information on how to write applications to use bindings mode connections, see IBM MQ classes for Java connection modes.