Sun Java System Message Queue 4.3 Developer's Guide for C Clients


The MQGetMessageReplyTo function passes back the destination where replies to this message should be sent.

MQGetMessageReplyTo (const MQMessageHandle messageHandle,
                           MQDestinationHandle * destinationHandle);

Return Value

MQStatus. See the MQStatusIsError() function for more information.



A handle to a message expecting a reply. This is the handle that is passed back to you when you receive the message.


Output parameter for the handle to the reply destination.

The sender uses the MQSetMessageReplyTo() function to specify a destination where replies to the message can be sent. This can be a normal destination or a temporary destination. The receiving client can pass the message handle to the MQGetMessageReplyTo() function and determine whether a destination for replies has been set up for the message by the sender and what that destination is. The consumer of the message can then use that handle as the destination to which it sends a reply.

You might need to call the MQGetDestinationType function to determine the type of the destination whose handle is returned to you: queue or topic so that you can set up your reply appropriately.

The advantage of setting up a temporary destination for replies is that Message Queue automatically creates a physical destination for you, rather than your having to have the administrator create one, when the broker’s auto.create.destination property is turned off.

You are responsible for freeing the destination handle by calling the function MQFreeDestination.()

Common Errors