Before a queue is deleted, it must be empty. Create a new administration message and set the delete action.
Figure 20. Deleting a queue in Java
/* Create an empty queue admin message and parameters field */ MQeQueueAdminMsg msg = new MQeQueueAdminMsg(); MQeFields parms = new MQeFields(); /** Prime message with who to reply to and a unique identifier */ /* Set name of queue to manage */ msg.setName( qMgrName, queueName ); /* Set the admin action to create a new queue */ msg.delete( parms );
Deletion of queue requires that the queue be empty of messages.
Figure 21. Deleting a queue in C
rc = mqeAdministrator_LocalQueue_delete(hAdministrator, &exceptBlk, hLocalQueueName, hLocalQMName); if ( EC(&exceptBlk) == MQERETURN_QUEUE_ERROR && ERC(&exceptBlk) == MQEREASON_QMGR_QUEUE_NOT_EMPTY) { /* queue not empty - take appropriate actions */ } }