Adapters, routing and aliases

Adapters

See Using adapters and Java Programming Reference for more information on adapters.

Routing connections

You can set up a connection so that a queue manager routes messages through an intermediate queue manager. This requires two connections:
  1. A connection to the intermediate queue manager
  2. A connection to the target queue manager
The first connection is created by the methods described earlier in this section, either as a client or as a peer connection. For the second connection, the name of the intermediate queue manager is specified in place of the network adapter name. With this configuration an application can put messages to the target queue manager but route them through one or more intermediate queue managers.

Aliases

You can assign multiple names or aliases to a connection. When an application calls methods on the MQeQueueManager class that require a queue manager name to be specified, it can also use an alias.

You can alias both local and remote queue managers. To alias a local queue manager, you must first establish a connection definition with the same name as the local queue manager. This is a logical connection that can have all parameters set to null.

To add and remove aliases, use the Action_AddAlias and Action_RemoveAlias actions of the MQeConnectionAdminMsg class. You can add or remove multiple aliases in one message. Put the aliases that you want to manipulate directly into the message by setting the ASCII array field Con_Aliases. Alternatively you can use the two methods addAlias() or removeAlias(). Each of these methods takes one alias name but you can call the method repeatedly to add multiple aliases to a message.

The following snippet of code shows how to add connection aliases to a message:
/**
 * Setup an admin msg to add aliases 
    to a queue manager (connection)
 */
public MQeConnectionAdminMsg addAliases(  String queueManagerName
                                  String aliases[] )
                                  throws Exception
{
  /*
   * Create an empty connection admin message
   */
  MQeConnectionAdminMsg msg = new MQeConnectionAdminMsg();

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

  /*
   * Set name of the connection to add aliases to 
   */
  msg.setName( queueManagerName );

  /*
   * Use the addAlias method to add aliases to the message.
   */
  for ( int i=0; i<aliases.length; i++ )
  {
    msg.addAlias( aliases[i] );
  }
  
  return msg;
}

Terms of use | WebSphere software

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