Get method
Retrieves a message from the queue.
This method takes an MQMessage object as a parameter, using some of the fields in the MQMD of the object as input parameters. In particular, the MessageId and CorrelId fields are used, so it is important to ensure that these fields are set as required. For more information about these fields, see MsgId (MQBYTE24) and CorrelId (MQBYTE24).
If the method fails then the MQMessage object is unchanged. If it succeeds, the MQMD and Message Data portions of the MQMessage object are replaced by the MQMD and Message Data from the incoming message. The MQMessage control properties are set as follows- MessageLength is set to length of the IBM MQ message
- DataLength is set to length of the IBM MQ message
- DataOffset is set to zero
- Defined in:
- MQQueue class
Syntax:
Call MQQueue.Get(Message, GetMsgOptions, GetMsgLength)
- Parameters
- Message:
MQMessage Object representing message to be retrieved.
GetMsgOptions:
Optional MQGetMessageOptions object to control the get operation. If this parameter is not specified, default MQGetMessageOptions are used.
GetMsgLength:
Optional 2 or 4 byte length value to control the maximum length of the IBM MQ message that is retrieved from the queue.
If the MQGMO_ACCEPT_TRUNCATED_MSG option is specified, the GET succeeds with a completion code of MQCC_WARNING and a reason code of MQRC_TRUNCATED_MSG_ACCEPTED if the message size exceeds the specified length.
The MessageData holds the first GetMsgLength bytes of data.
If MQGMO_ACCEPT_TRUNCATED_MSG is not specified, and the message size exceeds the specified length, the completion code of MQCC_FAILED together with reason code MQRC_TRUNCATED_MESSAGE_FAILED is returned.
If the contents of the message buffer are undefined, the total message length is set to the full length of the message that would have been retrieved.
If the message length parameter is not specified, the length of the message buffer is automatically adjusted to at least the size of the incoming message.