Queue manager aliases and clusters
Use queue manager aliases to hide the name of queue managers when sending messages into or out of a cluster, and to workload balance messages sent to a cluster.
RNAME, have five uses:- Remapping the queue manager name when sending messages
-
A queue manager alias can be used to remap the queue manager name specified in an MQOPEN call to another queue manager. It can be a cluster queue manager. For example, a queue manager might have the queue manager alias definition:
DEFINE QREMOTE(YORK) RNAME(' ') RQMNAME(CLUSQM)YORKcan be used as an alias for the queue manager calledCLUSQM. When an application on the queue manager that made this definition puts a message to queue managerYORK, the local queue manager resolves the name toCLUSQM. If the local queue manager is not calledCLUSQM, it puts the message on the cluster transmission queue to be moved toCLUSQM. It also changes the transmission header to sayCLUSQMinstead ofYORK.Note: The definition applies only on the queue manager that makes it. To advertise the alias to the whole cluster, you need to add theCLUSTERattribute to the remote-queue definition. Then messages from other queue managers that were destined forYORKare sent toCLUSQM. - Altering or specifying the transmission queue when sending messages
-
Aliasing can be used to join a cluster to a non-cluster system. For example, queue managers in the cluster
ITALYcould communicate with the queue manager calledPALERMO, which is outside the cluster. To communicate, one of the queue managers in the cluster must act as a gateway. From the gateway queue manager, issue the command:DEFINE QREMOTE(ROME) RNAME(' ') RQMNAME(PALERMO) XMITQ(X) CLUSTER(ITALY)The command is a queue manager alias definition. It defines and advertises
ROMEas a queue manager over which messages from any queue manager in the clusterITALYcan multi-hop to reach their destination atPALERMO. Messages put to a queue opened with the queue manager name set toROMEare sent to the gateway queue manager with the queue manager alias definition. Once there, the messages are put on the transmission queueXand moved by non-cluster channels to the queue managerPALERMO.The choice of the name
ROMEin this example is not significant. The values forQREMOTEandRQMNAMEcould both be the same. - Determining the destination when receiving messages
-
When a queue manager receives a message, it extracts the name of the destination queue and queue manager from the transmission header. It looks for a queue manager alias definition with the same name as the queue manager in the transmission header. If it finds one, it substitutes the
RQMNAMEfrom the queue manager alias definition for the queue manager name in the transmission header.There are two reasons for using a queue manager alias in this way:- To direct messages to another queue manager
- To alter the queue manager name to be the same as the local queue manager
- Using queue manager aliases in a gateway queue manager to route messages between queue managers in different clusters.
-
An application can send a message to a queue in a different cluster using a queue manager alias. The queue does not have to be a cluster queue. The queue is defined in one cluster. The application is connected to a queue manager in a different cluster. A gateway queue manager connects the two clusters. If the queue is not defined as clustered, for the correct routing to take place, the application must open the queue using the queue name and a clustered queue manager alias name. For an example of a configuration, see Creating two overlapping clusters with a gateway queue manager, from which the reply message flow illustrated in figure 1, is taken.
The diagram shows the path taken by the reply message back to a temporary dynamic queue, which is called
RQ. The server application, connected toQM3, opens the reply queue using the queue manager nameQM2. The queue manager nameQM2is defined as a clustered queue manager alias on gateway queue managerQM1.QM3routes the reply message to gateway queue managerQM1.QM1routes the message toQM2.Figure 1. Using a queue manager alias to return the reply message to a different cluster 
The way the routing works is as follows. Every queue manager in each cluster has a queue manager alias definition on gateway queue manager
QM1. The aliases are clustered in all the clusters. The grey dashed arrows from each of the aliases to a queue manager show that each queue manager alias is resolved to a real queue manager in at least one of the clusters. In this case, theQM2alias is clustered in both clusterCL1andCL2, and is resolved to the real queue managerQM2inCL1. The server application creates the reply message using the reply to queue nameRQ, and reply to queue manager nameQM2. The message is routed to gateway queue managerQM1because the queue manager alias definitionQM2is defined onQM1in clusterCL2and queue managerQM2is not in clusterCL2. As the message cannot be sent to the target queue manager, it is sent to the queue manager that has the alias definition.Gateway queue manager
QM1places the message on its cluster transmission queue for transfer toQM2. Gateway queue managerQM1routes the message toQM2because the queue manager alias definition onQM1forQM2definesQM2as the real target queue manager. The definition is not circular, because alias definitions can refer only to real definitions; the alias cannot point to itself. The real definition is resolved by gateway queue managerQM1, because bothQM1andQM2are in the same cluster,CL1. Gateway queue managerQM1finds out the connection information forQM2from the repository forCL1, and routes the message toQM2. For the message to be rerouted byQM1, the server application must have opened the reply queue with the option DEFBIND set toMQBND_BIND_NOT_FIXED. If the server application had opened the reply queue with the optionMQBND_BIND_ON_OPEN, the message is not rerouted and ends up on a dead letter queue. - Using a queue manager as a gateway into the cluster to workload balance messages from coming from outside the cluster.
-
You define a queue called
EDINBURGHon more than one queue manager in the cluster. You want the clustering mechanism to balance the workload for messages coming to that queue from outside the cluster.A queue manager from outside the cluster needs a transmit queue and sender-channel to one queue manager in the cluster. This queue is called a gateway queue manager. To take advantage of the default workload balancing mechanism, one of the following rules must apply:- The gateway queue manager must not contain an instance of the
EDINBURGHqueue. - The gateway queue manager specifies
CLWLUSEQ(ANY)onALTER QMGR.
For an example of workload balancing from outside a cluster, see Configuring workload balancing from outside a cluster
- The gateway queue manager must not contain an instance of the