INFO: Dynamic Queue Deletion and Return Code for MQSendMessage

ID: Q186191


The information in this article applies to:
  • Microsoft Message Queue Server version 1.0


SUMMARY

This article summarizes the return codes a Microsoft Message Queue Server (MSMQ) C API application sees that is operating on an open queue handle when the underlying queue instance is deleted from the Directory Service (DS).

In particular, MQSendMessage returns MQ_OK even if you delete the queue after opening it for Send in your C application. This behavior is by design as described below.


MORE INFORMATION

One way to simulate this scenario is to delete the queue in the Explorer after opening it in the application code.

If you delete the queue in Explorer after opening it in the application code, the MSMQ Send and Receive API returns the following codes:

  • MQSendMessage returns MQ_OK if you delete the queue after opening it for Send in your C application.


  • You receive a negative acknowledgment (bad destination) with MQMSG_CLASS_NACK_BAD_DST_Q as message class. To receive this acknowledgment, you must set up an admin queue and specify PROPID_M_ACKNOWLEDGE and PROPID_M_ADMIN_QUEUE when calling MQSendMessage. This is by design.

    NOTE: The sending computer opens the queue only once and does not query for the queue's existence again. So, the sending computer does not query if the queue is deleted after it opened it successfully. The destination queue can be located on a remote disconnected site. The same behavior occurs for queues located on the sending computer to keep the programming model coherent.


  • MQReceiveMessage returns an explicit error MQ_ERROR_QUEUE_DELETED if either the queue is deleted while your receive is pending or when you call receive using a handle to queue that has already been deleted.



REFERENCES

MSMQ SDK Online Help: search on: "Negative Arrival Acknowledgment Classes"; topic: ""MQMSG_CLASS_NACK_BAD_DST_Q"

For more information on setting up Acknowledgment messages, please see the MSMQ SDK help file.

Additional query words: kbDSupport kbdse kbnokeyword

Keywords :
Version : winnt:1.0
Platform : winnt
Issue type : kbinfo


Last Reviewed: August 30, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.