Oracle GlassFish Message Queue 4.4.2 Developer's Guide for C Clients

MQGetMessageType

The MQGetMessageType function passes back information about the type of a message: MQ_TEXT_MESSAGE, MQ_BYTES_MESSAGE , or MQ_MESSAGE.


MQGetMessageType(const MQMessageHandle messageHandle,
                       MQMessageType * messageType);

Return Value

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

Parameters

messageHandle

A handle to a message whose type you want to determine.

messageType

Output parameter that contains the message type: MQ_TEXT_MESSAGE or MQ_BYTES_MESSAGE.

After you obtain the handle to a message, you can determine the type of the message using the MQGetMessageType function. Having determined its type, you can use the MQGetTextMessageText() function or the MQGetBytesMessageBytes() function to obtain the message content.

Note that other message types might be added in the future. You should not design your code so that it only expects two possible message types.