get

 

public void get(MQMessage message, MQGetMessageOptions getMessageOptions, 
                int MaxMsgSize) throws MQException;

Retrieves a message from the queue, up to a maximum specified message size.

If the call fails, the MQMessage object is unchanged. If it succeeds, the message descriptor fields and message data portions of the MQMessage are completely overwritten by the fields and data from the incoming message.

If you perform a get with wait, all other threads using the same MQQueueManager are blocked until the call completes. If you need multiple threads to access WebSphere MQ simultaneously, then each thread must create its own MQQueueManager object.

Parameters

  • message - an input/output parameter which contains the message descriptor information and the returned message data. On input, some of the fields are used as input parameters, in particular messageId and correlationId. It is important to ensure that these are set as required.

  • getMessageOptions - options which control the action of the get. See MQGetMessageOptions.options for details.

  • MaxMsgSize - the largest message this call can to receive. If the message on the queue is larger than this, the result depends on whether the MQC.MQGMO_ACCEPT_TRUNCATED_MSG flag has been selected in MQGetMessageOptions.options.

    If the flag has been set, the message is filled with as much of the message data as will fit in the specified buffer size, and an MQException is thrown with completion code MQCC_WARNING and reason code MQRC_TRUNCATED_MSG_ACCEPTED.

    If the flag has not been set, the message is left on the queue and an MQException is thrown with completion code MQCC_FAILED and reason code MQRC_TRUNCATED_MSG_FAILED.

Exceptions

  • MQException - if the get fails.


uj14610_