Annotation Interface SqsListener
MessageListener or
AsyncMessageListener and set to a
MessageListenerContainer.
Each method will be handled by a different container instance, created by the specified factory() property.
If not specified, a default factory will be looked up in the context.
When used in conjunction with Spring Boot and auto configuration, the framework supplies a default
SqsMessageListenerContainerFactory and a
SqsAsyncClient, unless such beans are already found in the
ApplicationContext.
For more complex configurations, SqsMessageListenerContainerFactory instances
can be created and configured. See SqsMessageListenerContainerFactory.builder() for more information on
creating and configuring a factory.
Further configuration for containers created using this annotation can be achieved by declaring
SqsListenerConfigurer beans.
Methods with this annotation can have flexible signatures, including arguments of the following types:
Method signatures also acceptList<Pojo> and
ListMessage<Pojo> arguments . Such arguments will
configure the container to batch mode. When using List arguments, no other arguments can be provided. Metadata can be
retrieved by inspecting the Message instances'
MessageHeaders.
To support Acknowledgement and
BatchAcknowledgement arguments, the factory used to create the
containers must be set to AcknowledgementMode.MANUAL.
Properties in this annotation support property placeholders ("${...}") and SpEL ("#{...}").
- Since:
- 1.1
- Author:
- Alain Sahli, Matej Nedic, Tomaz Fernandes, Joao Calassio
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe acknowledgement mode to be used for the provided queues.TheMessageListenerContainerFactorybean name to be used to process this endpoint.An id for theMessageListenerContainerthat will be created to handle this endpoint.The maximum concurrent messages that can be processed simultaneously for each queue.The maximum number of messages to poll from SQS.The message visibility to be applied to messages received from the provided queues.The maximum number of seconds to wait for messages in a poll to SQS.String[]Alias forvalue()String[]Array of queue names or urls.
-
Element Details
-
value
String[] valueArray of queue names or urls. Queues declared in the same annotation will be handled by the sameMessageListenerContainer.- Returns:
- list of queue names or urls.
- Default:
- {}
-
queueNames
Alias forvalue()- Returns:
- list of queue names or urls.
- Default:
- {}
-
factory
String factoryTheMessageListenerContainerFactorybean name to be used to process this endpoint.- Returns:
- the factory bean name.
- Default:
- ""
-
id
String idAn id for theMessageListenerContainerthat will be created to handle this endpoint. If none provided a default ID will be created.- Returns:
- the container id.
- Default:
- ""
-
maxConcurrentMessages
String maxConcurrentMessagesThe maximum concurrent messages that can be processed simultaneously for each queue. Note that if acknowledgement batching is being used, the actual maximum number of inflight messages might be higher. Default is 10.- Returns:
- the maximum number of concurrent messages.
- Default:
- ""
-
pollTimeoutSeconds
String pollTimeoutSecondsThe maximum number of seconds to wait for messages in a poll to SQS.- Returns:
- the poll timeout.
- Default:
- ""
-
maxMessagesPerPoll
String maxMessagesPerPollThe maximum number of messages to poll from SQS. If a value greater than 10 is provided, the result of multiple polls will be combined, which can be useful forListenerMode.BATCH- Returns:
- the maximum messages per poll.
- Default:
- ""
-
messageVisibilitySeconds
String messageVisibilitySecondsThe message visibility to be applied to messages received from the provided queues. For Standard SQS queues and batch listeners, visibility will be applied at polling. For single message FIFO queues, visibility is changed before each remaining message from the same message group is processed.- Default:
- ""
-
acknowledgementMode
String acknowledgementModeThe acknowledgement mode to be used for the provided queues. If not specified, the acknowledgement mode defined for the container factory will be used.- Default:
- ""
-