Broker Client API batch reading not working

We have some code like this:

events = brokerClient.getEvents(configurableBatchsize, -1);

We found that the batchSize parameter is not working properly, it will depends on the document size in the broker queue, and the batchsize allowed to tune is only below Maximum_batch_Allowed, following are some obsevations.

Msg_Size Maximum_batch_Allowed Total_Size
11336 6 68016
109648 1 109648
13452 5 67260

Can somebody help on this? thanks in advance for your kindness.

Regards,
Michael

Few things that you can try out:

Server restricts the number of events to max-send-events (or something equivalent). Default is 20, so client cannot request more than 20 events.

Another related server parameter is max-send-eventsize (or something equivalent). This one is in bytes. Default is 65536, and server will stop batching as soon as total size exceeds this value.

Refer to 8.2 Broker Admin guides and look for section of broker configuration parameters for details.
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/Broker/8-2-SP3_Administering_Broker.pdf