Annotation Interface JmsListener
JmsListenerContainerFactoryto use to build the JMS listener container. If not set, a default container factory is assumed to be available with a bean name of
jmsListenerContainerFactoryunless an explicit default has been provided through configuration.
Consider setting up a custom
For production purposes, you'll typically fine-tune timeouts and recovery settings.
Most importantly, the default 'AUTO_ACKNOWLEDGE' mode does not provide reliability
guarantees, so make sure to use transacted sessions in case of reliability needs.
@JmsListener annotations is performed by registering a
JmsListenerAnnotationBeanPostProcessor. This can be done manually or,
more conveniently, through the
<jms:annotation-driven/> element or
Annotated JMS listener methods are allowed to have flexible signatures similar
Sessionto get access to the JMS session
Messageor one of its subclasses to get access to the raw JMS message
Messageto use Spring's messaging abstraction counterpart
@Payload-annotated method arguments, including support for validation
@Header-annotated method arguments to extract specific header values, including standard JMS headers defined by
@Headers-annotated method argument that must also be assignable to
Mapfor obtaining access to all headers
MessageHeadersarguments for obtaining access to all headers
JmsMessageHeaderAccessorfor convenient access to all method arguments
Annotated methods may have a non-
void return type. When they do,
the result of the method invocation is sent as a JMS reply to the destination
defined by the
JMSReplyTO header of the incoming message. If this header
is not set, a default destination can be provided by adding
@SendTo to the
This annotation can be used as a repeatable annotation.
This annotation may be used as a meta-annotation to create custom composed annotations with attribute overrides.
Required Element Summary
Optional Element SummaryModifier and TypeOptional ElementDescriptionThe concurrency limits for the listener, if any.The bean name of the
JmsListenerContainerFactoryto use to create the message listener container responsible for serving this endpoint.The unique identifier of the container managing this endpoint.The JMS message selector expression, if any.The name for the durable subscription, if any.
idString idThe unique identifier of the container managing this endpoint.
If none is specified, an auto-generated one is provided.
containerFactoryString containerFactoryThe bean name of the
JmsListenerContainerFactoryto use to create the message listener container responsible for serving this endpoint.
If not specified, the default container factory is used, if any.
subscriptionString subscriptionThe name for the durable subscription, if any.
selectorString selectorThe JMS message selector expression, if any.
See the JMS specification for a detailed definition of selector expressions.
concurrencyString concurrencyThe concurrency limits for the listener, if any. Overrides the value defined by the container factory used to create the listener container.
The concurrency limits can be a "lower-upper" String — for example, "5-10" — or a simple upper limit String — for example, "10", in which case the lower limit will be 1.
Note that the underlying container may or may not support all features. For instance, it may not be able to scale, in which case only the upper limit is used.