Queues can be known by multiple names or aliases. If you try to add an alias that already exists, you will get an error back.
To add an alias name to a queue, use the addAlias method on the MQeQueueAdminMsg. You can do multiple add and remove alias operations in one admin message.
Figure 22. Adding an alias to a queue in Java
/* Create an empty queue admin message and parameters field */ MQeQueueAdminMsg msg = new MQeQueueAdminMsg(); /** Prime message with who to reply to and a unique identifier * and set the name of the QueueManager and Queue */ /* Add a name that will be the alias of this queue */ msg.addAlias( "Fred" ); /* Set the admin action to update the queue */ msg.update( parms );
Use the addAlias() method to add an alias name. Note that aliases have to be added one at a time. For other types of queues, such as Remote Queues, the format of the API remains the same, just change LocalQueue to, for example, SyncRemoteQueue.
Figure 23. Adding an alias to a queue in C
rc = mqeAdministrator_LocalQueue_addAlias(hAdministrator, &exceptBlk, hLocalQueueName, hLocalQMName, hAliasName); if ( EC(&exceptBlk) == MQERETURN_NOTHING_TO_DO && ERC(&exceptBlk) ==MQEREASON_DUPLICATE ) { /* already has alias */ }