You can add and delete queue manager names with the Action_AddQueueManager and Action_RemoveQueueManager actions. You can add or remove multiple queue manager names with one administration message. You can put names directly into the message by setting the ASCII array field Queue_QMgrNameList. Alternatively, you can use the addQueueManager() and removeQueueManager() methods. Each of these methods takes one queue manager name, but you can call the method repeatedly to add multiple queue managers to a message.
This action is specific to store and forward queues. In this example multiple queue manager names are added to a String array, queueManagerNames, and set into the fields object. The action and fields object are added to the message.
/* Create an empty store and forward */ /* queue admin message and parameters field*/ /* all on one line*/ MQeStoreAndForwardQueueAdminMsg msg = new MQeStoreAndForwardQueueAdminMsg (qMgrName, queueName); MQeFields parms = new MQeFields(); /* Prime message with who to */ /* reply to and a unique identifier */ primeAdminMsg(msg); /* Add any characteristics of queue here, otherwise */ /* characteristics will be left to default values.*/ parms.putAsciiArray(MQeStoreAndForwardQueueAdminMsg.Queue_QMgrNameList,queueManagerNames); /* Set the admin action to add a queue manager to a queue */ msg.putInt(MQeAdminMsg.Admin_Action, MQeStoreAndForwardQueueAdminMsg.Action_AddQueueManager); /* Put the fields object into the message */ msg.putFields(MQeAdminMsg.Admin_Parms, parms);