Writing IBM MQ classes for Java applications
This collection of topics provides information to assist with writing Java applications to interact with IBM MQ systems.
To use IBM MQ classes for Java to access IBM MQ queues, you write Java applications that contain calls that put messages onto, and get messages from, IBM MQ queues. For details of individual classes, see IBM MQ classes for Java.
Note: Automatic client reconnection is not supported by IBM MQ classes for Java.The IBM MQ classes for Java interface
The procedural IBM MQ application programming interface uses verbs, which act on objects. The Java programming interface uses objects, which you act upon by calling methods.
The procedural IBM MQ application programming interface is built around verbs such as these:MQBACK, MQBEGIN, MQCLOSE, MQCONN, MQDISC, MQGET, MQINQ, MQOPEN, MQPUT, MQSET, MQSUB
These verbs all take, as a parameter, a handle to the IBM MQ object on which they are to operate. Your program consists of a set of IBM MQ objects, which you act upon by calling methods on those objects.
When we use the procedural interface, you disconnect from a queue manager by using the call MQDISC(Hconn, CompCode, Reason), where Hconn is a handle to the queue manager.
In the Java interface, the queue manager is represented by an object of class MQQueueManager. You disconnect from the queue manager by calling the disconnect() method on that class.// declare an object of type queue manager MQQueueManager queueManager=new MQQueueManager(); ... // do something... ... // disconnect from the queue manager queueManager.disconnect();
- IBM MQ classes for Java connection modes
The way you program for IBM MQ classes for Java has some dependencies on the connection modes we want to use. - Operations on queue managers
This collection of topics describes how to connect to, and disconnect from, a queue manager using IBM MQ classes for Java. - Accessing queues, topics, and processes in IBM MQ classes for Java
To access queues, topics, and processes, use methods of the MQQueueManager class. The MQOD (object descriptor structure) is collapsed into the parameters of these methods. - Handling messages in IBM MQ classes for Java
Messages are represented by the MQMessage class. You put and get messages using methods of the MQDestination class, which has subclasses of MQQueue and MQTopic. - Publish/subscribe in IBM MQ classes for Java
In IBM MQ classes for Java, the topic is represented by the MQTopic class, and you publish to it using the MQTopic.put() methods. - Handling IBM MQ message headers with IBM MQ classes for Java
Java classes are provided representing different types of message header. Two helper classes are also provided. - Handling PCF messages with IBM MQ classes for Java
Java classes are provided to create and parse PCF-structured messages, and to facilitate sending PCF requests and collecting PCF responses. - Handling message properties in IBM MQ classes for Java
Function calls to process message handles have no equivalent in IBM MQ classes for Java. To set, return, or delete message handle properties, use methods of the MQMessage class. - Handling errors in IBM MQ classes for Java
Handle errors arising from IBM MQ classes for Java using Java try and catch blocks. - Getting and setting attribute values in IBM MQ classes for Java
getXXX() and setXXX() methods are provided for many common attributes. Others can be accessed using the generic inquire() and set() methods. - Multithreaded programs in Java
The Java runtime environment is inherently multithreaded. IBM MQ classes for Java allows a queue manager object to be shared by multiple threads but ensures that all access to the target queue manager is synchronized. - Use channel exits in IBM MQ classes for Java
An overview of how to use channel exits in an application using the IBM MQ classes for Java. - Channel compression in IBM MQ classes for Java
Compressing the data that flows on a channel can improve the performance of the channel and reduce network traffic. IBM MQ classes for Java use the compression function built into IBM MQ. - Sharing a TCP/IP connection in IBM MQ classes for Java
Multiple instances of an MQI channel can be made to share a single TCP/IP connection. - Connection pooling in IBM MQ classes for Java
IBM MQ classes for Java allows spare connections to be pooled for reuse. - JTA/JDBC coordination using IBM MQ classes for Java
IBM MQ classes for Java supports the MQQueueManager.begin() method, which allows IBM MQ to act as a coordinator for a database which provides a JDBC type 2 or JDBC type 4 compliant driver. - Transport Layer Security (TLS) support in IBM MQ classes for Java
IBM MQ classes for Java client applications support TLS encryption. You require a JSSE provider to use TLS encryption. - Running IBM MQ classes for Java applications
If you write an application (a class that contains a main() method), using either the client or the bindings mode, run your program using the Java interpreter. - Java and JMS client connectivity to batch applications running on z/OS
A JMS, or IBM MQ classes for Java, application on z/OS can connect to a queue manager on z/OS, that has the ADVCAP(ENABLED) attribute, by using a client connection.
Parent topic: Use IBM MQ classes for Java