Package io.awspring.cloud.sqs.listener
Class SqsMessageListenerContainer<T>
java.lang.Object
io.awspring.cloud.sqs.listener.AbstractMessageListenerContainer<T,O,B>
io.awspring.cloud.sqs.listener.AbstractPipelineMessageListenerContainer<T,SqsContainerOptions,SqsContainerOptionsBuilder>
io.awspring.cloud.sqs.listener.SqsMessageListenerContainer<T>
- Type Parameters:
T
- theMessage
payload type. This type is used to ensure at compile time that all components in this container expect the same payload type. If the factory will be used with many payload types,Object
can be used.
- All Implemented Interfaces:
MessageListenerContainer<T>
,Lifecycle
,Phased
,SmartLifecycle
public class SqsMessageListenerContainer<T>
extends AbstractPipelineMessageListenerContainer<T,SqsContainerOptions,SqsContainerOptionsBuilder>
MessageListenerContainer
implementation for SQS queues. To create an instance, both constructors or the
builder()
method can be used, and further configuration can be achieved by using the
AbstractMessageListenerContainer.configure(Consumer)
method.
The SqsAsyncClient
instance to be used by this container must be set through the constructor or the
SqsMessageListenerContainer.Builder.sqsAsyncClient
method.
The container also accepts the following components:
MessageInterceptor
MessageListener
ErrorHandler
AsyncMessageInterceptor
AsyncMessageListener
AsyncErrorHandler
ContainerOptions
can be
changed when the container is stopped. Such changes will be effective upon container restart.
Containers created through the SqsListener
annotation will be registered in a
MessageListenerContainerRegistry
which will be responsible for managing their lifecycle. Containers created
manually and declared as beans will have their lifecycle managed by Spring Context.
Example using the builder:
@Bean
public SqsMessageListenerContainer
Example using the constructor:
@Bean
public SqsMessageListenerContainer
- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorsConstructorDescriptionSqsMessageListenerContainer
(software.amazon.awssdk.services.sqs.SqsAsyncClient sqsAsyncClient) SqsMessageListenerContainer
(software.amazon.awssdk.services.sqs.SqsAsyncClient sqsAsyncClient, SqsContainerOptions options) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SqsMessageListenerContainer.Builder<T>
builder()
protected Collection<ContainerComponentFactory<T,
SqsContainerOptions>> protected void
doConfigureMessageSink
(MessageSink<T> messageSink) protected void
doConfigureMessageSources
(Collection<MessageSource<T>> messageSources) Methods inherited from class io.awspring.cloud.sqs.listener.AbstractPipelineMessageListenerContainer
configureContainerComponents, configureMessageSink, configureMessageSources, createBackPressureHandler, createMessageProcessingPipeline, createMessageSource, createMessageSources, createSourcesTaskExecutor, createTaskExecutor, createThreadFactory, doStart, doStop, getAcknowledgementResultTaskExecutor, getComponentsTaskExecutor
Methods inherited from class io.awspring.cloud.sqs.listener.AbstractMessageListenerContainer
addMessageInterceptor, addMessageInterceptor, configure, getAcknowledgementResultCallback, getContainerComponentFactories, getContainerOptions, getErrorHandler, getId, getMessageInterceptors, getMessageListener, getQueueNames, isRunning, setAcknowledgementResultCallback, setAcknowledgementResultCallback, setAsyncMessageListener, setComponentFactories, setErrorHandler, setErrorHandler, setId, setMessageListener, setQueueNames, setQueueNames, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Constructor Details
-
SqsMessageListenerContainer
public SqsMessageListenerContainer(software.amazon.awssdk.services.sqs.SqsAsyncClient sqsAsyncClient, SqsContainerOptions options) -
SqsMessageListenerContainer
public SqsMessageListenerContainer(software.amazon.awssdk.services.sqs.SqsAsyncClient sqsAsyncClient)
-
-
Method Details
-
createDefaultComponentFactories
protected Collection<ContainerComponentFactory<T,SqsContainerOptions>> createDefaultComponentFactories() -
doConfigureMessageSources
-
doConfigureMessageSink
-
builder
-