Connections

Connections define how to connect one queue manager to another queue manager. Once a connection has been defined, it is possible for a queue manager to put messages to queues on the remote queue manager. The following diagram shows the constituent parts that are required for a remote queue on one queue manager to communicate with a queue on a different queue manager:
Figure 1. Queue manager connections
top Diagram showing the constituent parts required for a remote queue on a queue manager to communicate with a queue on another queue manager, that is a transporter and a network adapter on both queue managers, and a listener on the remote queue manager.
Communication happens at different levels:
Transporter:
Logical connection between two queues
Channel:
Logical connection between two systems
Adapter:
Protocol specific communication
The channel and adapter are specified as part of a connection definition. The transporter is specified as part of a remote queue definition. The following example code shows a method that instantiates and primes an MQeConnectionAdminMsg ready to create a connection:
/**
 * Setup an admin msg to create a connection definition
 */
public MQeConnectionAdminMsg addConnection( remoteQMgr
     adapter,
                  parms, 
                  options, 
                  channel, 
                  description ) throws Exception
{
  String remoteQMgr = "ServerQM";
  /*
   * Create an empty queue manager admin message and parameters field
   */
  MQeConnectionAdminMsg msg = new MQeConnectionAdminMsg();

  /*
   * Prime message with who to reply to and a unique identifier
   */
  MQeFields msgTest = primeAdminMsg( msg );

  /*
   * Set name of queue manager to add routes to
   */
  msg.setName( remoteQMgr );

  /*
   * Set the admin action to create a new queue
   * The connection is setup to use a default channel. This is an alias
   * which must have be setup on the queue manager for the connection to 
   * work.
   */
  msg.create( adapter,
              parms, 
              options, 
              channel, 
              description );
  
  return msg;
}

You use MQeConnectionAdminMsg to configure the client portion of a connection. The channel type is com.ibm.mqe.MQeChannel. Normally an alias of DefaultChannel is configured for MQeChannel. The following code fragment shows how to configure a connection on a client to communicate with a server using the HTTP protocol.

/**
 * Create a connection admin message that creates a connection 
 * definition to a remote queue manager using the HTTP protocol. Then
 * send the message to the client queue manager. 
 */
public addClientConnection( MQeQueueManager myQM, 
   String targetQMgr ) throws Exception
{
  String remoteQMgr  = "ServerQM";
  String adapter     = "Network:127.0.0.1:80";
// This assumes that an alias called Network has been setup for 
// network adapter com.ibm.mqe.adapters.MQeTcpipHttpAdapter 
  String parameters  = null;
  String options     = null;
  String channel     = "DefaultChannel";
  String description = "client connection to ServerQM";

  /*
   * Setup the admin msg
   */
  MQeConnectionAdminMsg msg = addConnection( remoteQMgr,
                                             adapter,
                                             parameters, 
                                             options, 
                                             channel, 
                                             description );

  /*
   *  Put the admin message to the admin queue (not using assured flows)
   */
  myQM.putMessage(targetQMgr,
   MQe.Admin_Queue_Name,
   msg, 
   null, 
   0 );

}

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.