/** * 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 ); }