java.lang.Object | |||||
↳ | org.springframework.jms.support.JmsAccessor | ||||
↳ | org.springframework.jms.support.destination.JmsDestinationAccessor | ||||
↳ | org.springframework.jms.listener.AbstractJmsListeningContainer | ||||
↳ | org.springframework.jms.listener.AbstractMessageListenerContainer | ||||
↳ | org.springframework.jms.listener.SimpleMessageListenerContainer |
Known Direct Subclasses |
Message listener container that uses the plain JMS client API's
MessageConsumer.setMessageListener()
method to
create concurrent MessageConsumers for the specified listeners.
This is the simplest form of a message listener container. It creates a fixed number of JMS Sessions to invoke the listener, not allowing for dynamic adaptation to runtime demands. Its main advantage is its low level of complexity and the minimum requirements on the JMS provider: Not even the ServerSessionPool facility is required.
See the AbstractMessageListenerContainer
javadoc for details
on acknowledge modes and transaction options.
For a different style of MessageListener handling, through looped
MessageConsumer.receive()
calls that also allow for
transactional reception of messages (registering them with XA transactions),
see DefaultMessageListenerContainer
.
DefaultMessageListenerContainer
JmsMessageEndpointManager
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jms.listener.AbstractJmsListeningContainer
| |||||||||||
From class
org.springframework.jms.support.JmsAccessor
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
JMS ExceptionListener implementation, invoked by the JMS provider in
case of connection failures.
| |||||||||||
Specify concurrency limits via a "lower-upper" String, e.g.
| |||||||||||
Specify the number of concurrent consumers to create.
| |||||||||||
Set whether to inhibit the delivery of messages published by its own connection.
| |||||||||||
Set the Spring TaskExecutor to use for executing the listener once
a message has been received by the provider.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a JMS MessageConsumer for the given Session and Destination.
| |||||||||||
Create a MessageConsumer for the given JMS Session,
registering a MessageListener for the specified listener.
| |||||||||||
Creates the specified number of concurrent consumers,
in the form of a JMS Session plus associated MessageConsumer.
| |||||||||||
Destroy the registered JMS Sessions and associated MessageConsumers.
| |||||||||||
Re-initializes this container's JMS message consumers,
if not initialized already.
| |||||||||||
Initialize the JMS Sessions and MessageConsumers for this container.
| |||||||||||
Return whether to inhibit the delivery of messages published by its own connection.
| |||||||||||
Registers this listener container as JMS ExceptionListener on the shared connection.
| |||||||||||
Process a message received from the provider.
| |||||||||||
Always use a shared JMS Connection.
| |||||||||||
Validate the configuration of this container.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jms.listener.AbstractMessageListenerContainer
| |||||||||||
From class
org.springframework.jms.listener.AbstractJmsListeningContainer
| |||||||||||
From class
org.springframework.jms.support.destination.JmsDestinationAccessor
| |||||||||||
From class
org.springframework.jms.support.JmsAccessor
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanNameAware
| |||||||||||
From interface
org.springframework.beans.factory.DisposableBean
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.Lifecycle
| |||||||||||
From interface
org.springframework.context.Phased
| |||||||||||
From interface
org.springframework.context.SmartLifecycle
|
JMS ExceptionListener implementation, invoked by the JMS provider in case of connection failures. Re-initializes this listener container's shared connection and its sessions and consumers.
ex | the reported connection exception |
---|
Specify concurrency limits via a "lower-upper" String, e.g. "5-10", or a simple upper limit String, e.g. "10".
This listener container will always hold on to the maximum number of
consumers setConcurrentConsumers(int)
since it is unable to scale.
This property is primarily supported for configuration compatibility with
DefaultMessageListenerContainer
. For this local listener container,
generally use setConcurrentConsumers(int)
instead.
Specify the number of concurrent consumers to create. Default is 1.
Raising the number of concurrent consumers is recommendable in order to scale the consumption of messages coming in from a queue. However, note that any ordering guarantees are lost once multiple consumers are registered. In general, stick with 1 consumer for low-volume queues.
Do not raise the number of concurrent consumers for a topic. This would lead to concurrent consumption of the same message, which is hardly ever desirable.
Set whether to inhibit the delivery of messages published by its own connection. Default is "false".
Set the Spring TaskExecutor to use for executing the listener once a message has been received by the provider.
Default is none, that is, to run in the JMS provider's own receive thread, blocking the provider's receive endpoint while executing the listener.
Specify a TaskExecutor for executing the listener in a different thread, rather than blocking the JMS provider, usually integrating with an existing thread pool. This allows to keep the number of concurrent consumers low (1) while still processing messages concurrently (decoupled from receiving!).
NOTE: Specifying a TaskExecutor for listener execution affects acknowledgement semantics. Messages will then always get acknowledged before listener execution, with the underlying Session immediately reused for receiving the next message. Using this in combination with a transacted session or with client acknowledgement will lead to unspecified results!
NOTE: Concurrent listener execution via a TaskExecutor will lead
to concurrent processing of messages that have been received by the same
underlying Session. As a consequence, it is not recommended to use
this setting with a SessionAwareMessageListener
, at least not
if the latter performs actual work on the given Session. A standard
javax.jms.MessageListener will work fine, in general.
Create a JMS MessageConsumer for the given Session and Destination.
This implementation uses JMS 1.1 API.
session | the JMS Session to create a MessageConsumer for |
---|---|
destination | the JMS Destination to create a MessageConsumer for |
if thrown by JMS API methods | |
JMSException |
Create a MessageConsumer for the given JMS Session, registering a MessageListener for the specified listener.
session | the JMS Session to work on |
---|
if thrown by JMS methods | |
JMSException |
Creates the specified number of concurrent consumers, in the form of a JMS Session plus associated MessageConsumer.
JMSException |
---|
Destroy the registered JMS Sessions and associated MessageConsumers.
JMSException |
---|
Re-initializes this container's JMS message consumers, if not initialized already.
JMSException |
---|
Initialize the JMS Sessions and MessageConsumers for this container.
in case of setup failure | |
JMSException |
Return whether to inhibit the delivery of messages published by its own connection.
Registers this listener container as JMS ExceptionListener on the shared connection.
connection | the Connection to prepare |
---|
JMSException |
---|
Process a message received from the provider.
Executes the listener, exposing the current JMS Session as thread-bound resource (if "exposeListenerSession" is "true").
message | the received JMS Message |
---|---|
session | the JMS Session to operate on |
Always use a shared JMS Connection.
Validate the configuration of this container.
The default implementation is empty. To be overridden in subclasses.