Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the value of `MaxMsgLength` of queue

Tags:

ibm-mq

I am trying to write simple string message into a queue. The MaxMsgLength property of queue is set as 4 kb. The message has 2700 characters and when I try to put into queue I am getting 2030 (07EE) (RC2030): MQRC_MSG_TOO_BIG_FOR_Q exception. I am not doing any special kind of encoding and hence whatever is default for Windows should be used.

I want to know how to determine the value that I should give in MaxMsgLength property. How to calculate that.

like image 213
Jchenna Avatar asked Apr 25 '14 21:04

Jchenna


2 Answers

Please remember that the MaxMsgLength as specified in the queue definition includes not just the payload, but also the message header and any properties that you set. If you check the Infocenter MQ_* (String Lengths) page and look for MQ_MSG_HEADER_LENGTH you will see that the MQMD alone is 4000 bytes. So if you set the MaxMsgLength of the queue to 4k, the largest payload you can have is 96 bytes. If the queue in question is a transmission queue, you need the queue size plus the size of the MQXQH transmission queue header.

To specifically answer the question in the title of the post, you can find the MaxMsgLength in two ways. Visually, by displaying the queue attributes. Programmatically, add "Inquire" to the open options when opening the queue and use the MQInq API call. Then add the total of the MQMD, any properties that you add (including the XML structures that contain them but are not returned in the API calls that manipulate them) plus any headers such as RFH2 (if the queues are set to use that instead of native properties), MQXQH, MQDLQ, etc.

like image 190
T.Rob Avatar answered Oct 29 '22 17:10

T.Rob


Not sure what language you are using in your application. Assuming it is C, check BufferLength parameter value you have specified on the MQPUT call.

This IBM MQ InfoCenter link explains the case where you can run into 2030 error and possible remedies.

like image 23
Shashi Avatar answered Oct 29 '22 16:10

Shashi