Deleting a Queue

Deleting a queue is done with a single call to MQDeleteQueue.

    To delete a queue
  1. Obtain the format name of the queue. It is returned by MQCreateQueue when the queue is created. If the format name of the queue is not known, you can obtain a format name by using one of the following format name translation functions:

    MQHandleToFormatName

    MQInstanceToFormatName

    MQPathNameToFormatName

  2. Call MQDeleteQueue to delete the queue.
    hr = MQDeleteQueue(szwFormatName);  
     
    If (FAILED(hr))
    {
        // MQDeleteQueue error handler.
    }
     

Example

The following example deletes the queue.

/////////////////
// Delete queue.
/////////////////
hr = MQDeleteQueue(szwFormatName);  

If (FAILED(hr))
   {
   // MQDeleteQueue error handler.
}