The following is an example of how MQ Connector might work. MQ Connector adapts its behavior to the existing WebSphere MQ definition that will be different for each environment. For instance, it is not mandatory to have two channels defined as in this example. They are only needed if two queue managers are used.
The MQ Connector service puts messages in a local queue to be sent to a remote queue manager. The local queue manager has definitions for a transmission queue and a channel.
To send and receive messages, the queue manager has two channels defined, as shown in the following figure (where they are identified as SERVER.TO.HOST and HOST.TO.SERVER):
The HOST.TO.SERVER channel is of type server-requested, because the MQ Connector service starts the channel and the sender terminates the call. The local queue in the MQ Connector service, shown here as replyToQ, receives responses from the host.
An application can send data using WebSphere MQ in the following two ways:
▪ The application can create the MQMessage to be sent
▪ The application can let the service create the MQMessage with a sequence number assigned by the sending channel (MQConnection)
To receive data, the application has the following two options:
▪ The application wants to send a message and receive only the response to this message. In this case, the sequence number is used as a reference to get the response. It is regarded as a permanent attribute of the message, and is consequently retained by the receiving channel to identify the replies. (External definition tag synchronousMode="enabled")
▪ The application wants to receive all the messages coming from the receive queue assigned to MQConnection. In this case, the message sequence numbering can be removed by the receiving channel. The application must also send the message. The difference between this and the previous implementation is that here the response corresponding to a request is identified by another method; for example, by the message itself. (External definition tag synchronousMode="disabled")
A dynamic queue is a local WebSphere MQ queue that is created when an application opens a model queue object. A model queue is a queue definition template that sets the attributes of the queue such as the name of the queue and whether it is temporary or permanent.
The MQ Connector component uses dynamic queues in the same way it uses static queues. An application should use a dynamic queue when the following are true:
▪ There is no need to retain the queue after the application terminates.
▪ The responses to the application's messages must be processed by a different application. In this case, the first application creates a reply-to queue that points to the second application.
▪ There is a need to reduce the system administration required for queue configuration and operational management of these queues.
WebSphere MQ automatically deletes a temporary dynamic queue when the application sends a closeConnection call.
The MQ Connector requires the Communications Pool to support dynamic queues. The names of the queues must be unique within the pool.