Class BatchingAcknowledgementProcessor<T>

java.lang.Object
io.awspring.cloud.sqs.listener.acknowledgement.AbstractOrderingAcknowledgementProcessor<T>
io.awspring.cloud.sqs.listener.acknowledgement.BatchingAcknowledgementProcessor<T>
All Implemented Interfaces:
AcknowledgementCallback<T>, AcknowledgementProcessor<T>, ExecutingAcknowledgementProcessor<T>, ConfigurableContainerComponent, IdentifiableContainerComponent, TaskExecutorAware, Lifecycle, Phased, SmartLifecycle

public class BatchingAcknowledgementProcessor<T> extends AbstractOrderingAcknowledgementProcessor<T> implements TaskExecutorAware
AcknowledgementProcessor implementation that adds the messages to a BlockingQueue to be acknowledged according to ContainerOptions.getAcknowledgementInterval() and ContainerOptions.getAcknowledgementThreshold(). The messages are constantly polled from the queue and added to a buffer. When a message is polled, the processor checks the queue size against the configured threshold and sends batches for execution if the threshold is breached. A separate scheduled thread is activated when the configured amount of time has passed between the last acknowledgement execution. This thread then empties the buffer and sends all messages to execution. All buffer access must be synchronized by the Lock. When this processor is signaled to Lifecycle.stop(), it waits for up to acknowledgementShutdownTimeout seconds for ongoing acknowledgement executions to complete. After that time, it will cancel all executions and return the flow to the caller.
Since:
3.0
Author:
Tomaz Fernandes