The MQ Connector service enables a local application to communicate with a partner application through WebSphere MQ. It handles communication between the server and the host. The service uses WebSphere MQ for Java (package name com.ibm.mq). The particular WebSphere MQ classes used by the toolkit depend on the type of connection mode that you want to use, client connections mode or bindings mode, as follows:
▪ Client connections mode: When the WebSphere MQ classes are used as a client (when the external definition tag clientorServer="client"), the client has the following restrictions and behavior:
▪ It supports only TCP/IP.
▪ It stores information that would be stored in a channel definition and in environment variables in a class called MQEnvironment. It can pass this information to the channel definition and environment variables as parameters when it makes the connection.
▪ It writes error and exception conditions to a log specified in the MQException class. The default error destination is the Java console.
▪ It does not support connection tables.
▪ It does not read any WebSphere MQ environment variables at startup.
▪ It does not support the MQBEGIN verb or fast bindings.
▪ Bindings mode: When the WebSphere MQ classes are used in bindings mode (when the external definition tag clientorServer="server"), most of the parameters provided by the MQEnvironment class are ignored and the MQBEGIN verb and fast bindings into the WebSphere MQ queue manager are supported.
The main class of the MQ Connector service is MQConnection. Each instance of this class maps to a WebSphere MQ queue manager, a WebSphere MQ send queue, and a WebSphere MQ reply queue. The MQConnection class inherits from Service and implements the MQConnectionService interface, which in turn extends the CommonCommunicationsService interface.
This service, like all communication services, can work in either synchronous or asynchronous mode, which work as follows:
▪ In synchronous mode, the receive(correlationId, timeout) method is used to read a message response for the specified correlation id or message id. This method waits until the timeout is reached.
▪ For asynchronous behavior, an event is signaled when data arrives. The event contains the MQMessage received.