I have question about BatchingRabbitTemplate ?
Fisrt, I use batch stategy to publish message. I wonder if message < batchSize for a long time spring amqp will be publish message automaticaly right? eg. timeout
Second, What is the best appropriate value of batchingRabbitTemplate(batchSize,bufferLimit, timeout)
Finally, What is the timeout parameter (BatchingRabbitTemplate)
Thank a lot ^^
CodePudding user response:
Yes, the default SimpleBatchingStrategy
will cause a "short" batch to be sent if the total size exceeds the buffer limit or the time since the last message exceeds the timeout.
/**
* @param batchSize the batch size.
* @param bufferLimit the max buffer size; could trigger a short batch. Does not apply
* to a single message.
* @param timeout the batch timeout.
*/
public SimpleBatchingStrategy(int batchSize, int bufferLimit, long timeout) {
this.batchSize = batchSize;
this.bufferLimit = bufferLimit;
this.timeout = timeout;
}
There is no "best" value for the timeout - that is entirely up to you to decide.