Class AbstractOrderingAcknowledgementProcessor<T>
java.lang.Object
io.awspring.cloud.sqs.listener.acknowledgement.AbstractOrderingAcknowledgementProcessor<T>
- All Implemented Interfaces:
AcknowledgementCallback<T>,AcknowledgementProcessor<T>,ExecutingAcknowledgementProcessor<T>,ConfigurableContainerComponent,IdentifiableContainerComponent,Lifecycle,Phased,SmartLifecycle
- Direct Known Subclasses:
BatchingAcknowledgementProcessor,ImmediateAcknowledgementProcessor
public abstract class AbstractOrderingAcknowledgementProcessor<T>
extends Object
implements ExecutingAcknowledgementProcessor<T>, AcknowledgementCallback<T>
Base implementation for a
AcknowledgementProcessor with SmartLifecycle
capabilities. Also provides acknowledgement ordering capabilities for AcknowledgementOrdering.ORDERED.- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(ContainerOptions<?, ?> containerOptions) Configure the component with the providedContainerOptionsinstanceprotected voiddoConfigure(ContainerOptions<?, ?> containerOptions) protected abstract CompletableFuture<Void>doOnAcknowledge(Collection<Message<T>> messages) protected abstract CompletableFuture<Void>doOnAcknowledge(Message<T> message) protected voiddoStart()protected voiddoStop()Retrieve an acknowledgement callback that can be used to offer messages to be acknowledged by this processor.getId()Get the component id.booleanonAcknowledge(Collection<Message<T>> messages) Triggers acknowledgement for the given messages.onAcknowledge(Message<T> message) Triggers acknowledgement for the given message.protected CompletableFuture<Void>sendToExecutor(Collection<Message<T>> messagesToAck) voidsetAcknowledgementExecutor(AcknowledgementExecutor<T> acknowledgementExecutor) voidsetAcknowledgementResultCallback(AsyncAcknowledgementResultCallback<T> acknowledgementResultCallback) voidSet the component id.voidsetMaxAcknowledgementsPerBatch(int maxAcknowledgementsPerBatch) voidsetMessageGroupingFunction(Function<Message<T>, String> messageGroupingFunction) voidstart()voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Constructor Details
-
AbstractOrderingAcknowledgementProcessor
public AbstractOrderingAcknowledgementProcessor()
-
-
Method Details
-
getAcknowledgementCallback
Description copied from interface:AcknowledgementProcessorRetrieve an acknowledgement callback that can be used to offer messages to be acknowledged by this processor.- Specified by:
getAcknowledgementCallbackin interfaceAcknowledgementProcessor<T>- Returns:
- the callback.
-
configure
Description copied from interface:ConfigurableContainerComponentConfigure the component with the providedContainerOptionsinstance- Specified by:
configurein interfaceConfigurableContainerComponent
-
doConfigure
-
setAcknowledgementExecutor
- Specified by:
setAcknowledgementExecutorin interfaceExecutingAcknowledgementProcessor<T>
-
setAcknowledgementResultCallback
public void setAcknowledgementResultCallback(AsyncAcknowledgementResultCallback<T> acknowledgementResultCallback) - Specified by:
setAcknowledgementResultCallbackin interfaceExecutingAcknowledgementProcessor<T>
-
setMaxAcknowledgementsPerBatch
public void setMaxAcknowledgementsPerBatch(int maxAcknowledgementsPerBatch) -
setMessageGroupingFunction
-
setId
Description copied from interface:IdentifiableContainerComponentSet the component id.- Specified by:
setIdin interfaceIdentifiableContainerComponent- Parameters:
id- the id.
-
getId
Description copied from interface:IdentifiableContainerComponentGet the component id.- Specified by:
getIdin interfaceIdentifiableContainerComponent- Returns:
- the id.
-
start
public void start() -
doStart
protected void doStart() -
onAcknowledge
Description copied from interface:AcknowledgementCallbackTriggers acknowledgement for the given message.- Specified by:
onAcknowledgein interfaceAcknowledgementCallback<T>- Parameters:
message- the message.- Returns:
- a completable future.
-
onAcknowledge
Description copied from interface:AcknowledgementCallbackTriggers acknowledgement for the given messages.- Specified by:
onAcknowledgein interfaceAcknowledgementCallback<T>- Parameters:
messages- the messages.- Returns:
- a completable future.
-
stop
public void stop() -
doStop
protected void doStop() -
isRunning
public boolean isRunning() -
getMessageGroupingFunction
-
sendToExecutor
-
doOnAcknowledge
-
doOnAcknowledge
-