Class AbstractMessageProcessingPipelineSink<T>
java.lang.Object
io.awspring.cloud.sqs.listener.sink.AbstractMessageProcessingPipelineSink<T>
- Type Parameters:
T- theMessagepayload type.
- All Implemented Interfaces:
ConfigurableContainerComponent,ObservableComponent,MessageProcessingPipelineSink<T>,MessageSink<T>,TaskExecutorAware,Lifecycle,Phased,SmartLifecycle
- Direct Known Subclasses:
BatchMessageSink,FanOutMessageSink,OrderedMessageSink
public abstract class AbstractMessageProcessingPipelineSink<T>
extends Object
implements MessageProcessingPipelineSink<T>, TaskExecutorAware, ObservableComponent
Base implementation for
MessageProcessingPipelineSink containing SmartLifecycle features and useful
execution methods that can be used by subclasses.- 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 abstract CompletableFuture<Void>doEmit(Collection<Message<T>> messages, MessageProcessingContext<T> context) emit(Collection<Message<T>> messages, MessageProcessingContext<T> context) Emit the providedMessageinstances to the providedAsyncMessageListener.protected CompletableFuture<Void>execute(Collection<Message<T>> messages, MessageProcessingContext<T> context) Send the providedMessageinstances to theTaskExecutoras a unit of work.protected CompletableFuture<Void>execute(Message<T> message, MessageProcessingContext<T> context) Send the providedMessageto theTaskExecutoras a unit of work.booleanprotected VoidlogError(Throwable t, Collection<Message<T>> msgs) protected VoidvoidsetMessagePipeline(MessageProcessingPipeline<T> messageProcessingPipeline) Set theMessageProcessingPipelineinstance that this sink will emitMessageinstances to.voidsetObservationSpecifics(AbstractListenerObservation.Specifics<?> observationSpecifics) Set the Observation-related instances that are specific to a messaging system.voidsetTaskExecutor(TaskExecutor taskExecutor) Set the task executor.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
-
AbstractMessageProcessingPipelineSink
public AbstractMessageProcessingPipelineSink()
-
-
Method Details
-
setMessagePipeline
Description copied from interface:MessageProcessingPipelineSinkSet theMessageProcessingPipelineinstance that this sink will emitMessageinstances to.- Specified by:
setMessagePipelinein interfaceMessageProcessingPipelineSink<T>- Parameters:
messageProcessingPipeline- the pipeline.
-
setTaskExecutor
Description copied from interface:TaskExecutorAwareSet the task executor.- Specified by:
setTaskExecutorin interfaceTaskExecutorAware- Parameters:
taskExecutor- the task executor.
-
setObservationSpecifics
Description copied from interface:ObservableComponentSet the Observation-related instances that are specific to a messaging system.- Specified by:
setObservationSpecificsin interfaceObservableComponent- Parameters:
observationSpecifics- the observation-related instances.
-
configure
Description copied from interface:ConfigurableContainerComponentConfigure the component with the providedContainerOptionsinstance- Specified by:
configurein interfaceConfigurableContainerComponent
-
emit
public CompletableFuture<Void> emit(Collection<Message<T>> messages, MessageProcessingContext<T> context) Description copied from interface:MessageSinkEmit the providedMessageinstances to the providedAsyncMessageListener.- Specified by:
emitin interfaceMessageSink<T>- Parameters:
messages- the messages to emit.- Returns:
- a collection of
CompletableFutureinstances, each representing the completion signal of a single message processing.
-
doEmit
protected abstract CompletableFuture<Void> doEmit(Collection<Message<T>> messages, MessageProcessingContext<T> context) -
execute
Send the providedMessageto theTaskExecutoras a unit of work.- Parameters:
message- the message to be executed.context- the processing context.- Returns:
- the processing result.
-
execute
protected CompletableFuture<Void> execute(Collection<Message<T>> messages, MessageProcessingContext<T> context) Send the providedMessageinstances to theTaskExecutoras a unit of work.- Parameters:
messages- the messages to be executed.context- the processing context.- Returns:
- the processing result.
-
logError
-
logError
-
start
public void start() -
stop
public void stop() -
isRunning
public boolean isRunning()
-