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)
YORK
can 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 sayCLUSQM
instead 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 theCLUSTER
attribute to the remote-queue definition. Then messages from other queue managers that were destined forYORK
are 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
ITALY
could 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
ROME
as a queue manager over which messages from any queue manager in the clusterITALY
can multi-hop to reach their destination atPALERMO
. Messages put to a queue opened with the queue-manager name set toROME
are sent to the gateway queue manager with the queue manager alias definition. Once there, the messages are put on the transmission queueX
and moved by non-cluster channels to the queue managerPALERMO
.The choice of the name
ROME
in this example is not significant. The values forQREMOTE
andRQMNAME
could 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
RQMNAME
from 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 nameQM2
is defined as a clustered queue manager alias onQM1
.QM3
routes the reply message toQM1
.QM1
routes the message toQM2
.The way the routing works is as follows. Every queue manager in each cluster has a queue manager alias definition on
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, theQM2
alias is clustered in both clusterCL1
andCL2
, and is resolved to the real queue managerQM2
inCL1
. The server application creates the reply message using the reply to queue nameRQ
, and reply to queue manager nameQM2
. The message is routed toQM1
because the queue manager alias definitionQM2
is defined onQM1
in clusterCL2
and queue managerQM2
is 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.QM1
places the message on the cluster transmission queue onQM1
for transferal toQM2
.QM1
routes the message toQM2
because the queue manager alias definition onQM1
forQM2
definesQM2
as 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 byQM1
, because bothQM1
andQM2
are in the same cluster,CL1
.QM1
finds out the connection information forQM2
from 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
EDINBURGH
on 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
EDINBURGH
queue. - 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