sag.jar setMaxReceiveLen and setAdjustReceiveLen usage

Dear members,

I need some help regarding the setMaxReceiveLen and setAdjustReceiveLen params in the sag.jar used in java for entirex broker communication.

If the setMaxReceiveLen is set to 32000 in my java program but the max message size of entirex message is 32768, what will happen to the broker message that is of 32768 bytes? Will the extra 768 bytes be truncated when read by the java job or will the message be completely rejected as it is bigger than 32000?

Also what is the use of setAdjustReceiveLen? If it is set to true, even when the setMaxReceiveLen is set 32000, the message will be read fully (even if the max message size in broker is 32768 bytes); is it correct?

Thanks in advance for your reply!

Please see the Java API descriptions at

  • if you receive a response that is greater than the max receive length set, you will get an error (0020 0094). No truncation will take place, no message is returned.
  • if you set setAdjustReceiveLen to true, then the BrokerService will intercept the 0020 0094 error and call EntireX Broker again for the same message with an increased receive length. In some high-performance situations, you will not want the extra call, but need to see the error message in order to set the max receive length correctly. In other situations you may not want to receive a larger message due to memory constraints or data validation (if the length is wrong, then perhaps you have received an invalid message).
  • the message size cannot exceed the maximum set for the Broker or Service definition in the Broker attributes with MAX-MESSAGE-LENGTH

So, if you setMaxReceiveLen to 32000 and setAdjustReceiveLen is true, your program won’t notice as the full 32k message will be returned.

In any case, the maximum length of a message for EntireX is 2gb, not 32k. Your installation may have set a different MAX-MESSAGE-LENGTH for the Broker, but if you have a reason for a larger message, you should discuss increasing the maximum with them.

Well, it looks like we should add a note to the Java doc :x

If your Broker is version 8.2.2. or higher you can simply ignore these 2 methods. With the newer versions of the Broker the Java application will receive all the data returned by the Broker automagically.