In the BufferLength parameter of the MQGET call, specify the size of the buffer area to hold the message data that you retrieve. You decide how big this should be in three ways:
However, you can use the MQGMO_ACCEPT_TRUNCATED_MSG option in the MQGMO structure if you want the MQGET call to complete even if the message is too big for the buffer. In this case:
Without this option, the call still completes with a warning, but it does not remove the message from the queue (or advance the browse cursor).
If your program is serving a queue that is also being served by other programs, one of those other programs might remove the message that you want before your program can issue another MQGET call. Your program could waste time searching for a message that no longer exists. To avoid this, first browse the queue until you find the message that you want, specifying a BufferLength of zero and using the MQGMO_ACCEPT_TRUNCATED_MSG option. This positions the browse cursor under the message that you want. You can then retrieve the message by calling MQGET again, specifying the MQGMO_MSG_UNDER_CURSOR option. If another program removes the message between your browse and removal calls, your second MQGET fails immediately (without searching the whole queue), because there is no message under your browse cursor.
Try to make the buffer size as close as possible to the actual message size to avoid reduced performance.
For further information about the MaxMsgLength attribute, see Increasing the maximum message length.
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
bufarea |