defining" /> Defining an alias queue

 

Defining an alias queue

The following command creates an alias queue:

CRTMQMQ QNAME('my.alias.queue') QTYPE(*ALS) TGTQNAME('yellow.queue')
MQMNAME(MYQUEUEMANAGER) 

This command redirects MQI calls that specify my.alias.queue to the queue yellow.queue. The command does not create the target queue; the MQI calls fail if the queue yellow.queue does not exist at run time.

If you change the alias definition, we can redirect the MQI calls to another queue. For example:

CHGMQMQ QNAME('my.alias.queue') TGTQNAME('magenta.queue') MQMNAME(MYQUEUEMANAGER)

This command redirects MQI calls to another queue, magenta.queue.

We can also use alias queues to make a single queue (the target queue) appear to have different attributes for different applications. You do this by defining two aliases, one for each application. Suppose there are two applications:

We can do this using the following commands:

/* This alias is put enabled and get disabled for application ALPHA */
 
CRTMQMQ QNAME('alphas.alias.queue') QTYPE(*ALS)  TGTQNAME('yellow.queue')
PUTENBL(*YES) GETENBL(*NO) MQMNAME(MYQUEUEMANAGER)
 
/* This alias is put disabled and get enabled for application BETA */
 
CRTMQMQ QNAME('betas.alias.queue') QTYPE(*ALS) TGTQNAME('yellow.queue')
PUTENBL(*NO) GETENBL(*YES) MQMNAME(MYQUEUEMANAGER) 

ALPHA uses the queue name alphas.alias.queue in its MQI calls; BETA uses the queue name betas.alias.queue. They both access the same queue, but in different ways.

We can use the REPLACE *YES attribute when you define alias queues, in the same way that you use these attributes with local queues.