java.lang.Objectorg.springframework.jms.support.JmsAccessor
org.springframework.jms.support.destination.JmsDestinationAccessor
org.springframework.jms.listener.AbstractJmsListeningContainer
org.springframework.jms.listener.AbstractMessageListenerContainer
All Implemented Interfaces:
DisposableBean, BeanNameAware, Lifecycle, InitializingBean
Direct Known Subclasses:
ServerSessionMessageListenerContainer102, ServerSessionMessageListenerContainer, DefaultMessageListenerContainer, DefaultMessageListenerContainer102, SimpleMessageListenerContainer102, AbstractPollingMessageListenerContainer, SimpleMessageListenerContainer
Usually holds a single JMS Connection that all listeners are supposed to be registered on, which is the standard JMS way of managing listeners. Can alternatively also be used with a fresh Connection per listener, for J2EE-style XA-aware JMS messaging. The actual registration process is up to concrete subclasses.
NOTE: The default behavior of this message listener container is to never propagate an exception thrown by a message listener up to the JMS provider. Instead, it will log any such exception at the error level. This means that from the perspective of the attendant JMS provider no such listener will ever fail.
The listener container offers the following message acknowledgment options:
There are two solutions to the duplicate processing problem:
Recommendations:
Note that it is also possible to specify a org.springframework.jms.connection.JmsTransactionManager as external "transactionManager", providing fully synchronized Spring transactions based on local JMS transactions. The effect is similar to "sessionTransacted" set to "true", the difference being that this external transaction management will also affect independent JMS access code within the service layer (e.g. based on org.springframework.jms.core.JmsTemplate or org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy ), not just direct JMS Session usage in a SessionAwareMessageListener .
Juergen - Hoeller2.0 - | Fields inherited from org.springframework.jms.listener.AbstractJmsListeningContainer: |
|---|
| sharedConnectionMonitor, lifecycleMonitor |
| Fields inherited from org.springframework.jms.support.JmsAccessor: |
|---|
| logger |
| Methods from org.springframework.jms.listener.AbstractJmsListeningContainer: |
|---|
| afterPropertiesSet, createSharedConnection, destroy, doInitialize, doRescheduleTask, doShutdown, doStart, doStop, establishSharedConnection, getBeanName, getClientId, getPausedTaskCount, getSharedConnection, initialize, isActive, isRunning, logRejectedTask, prepareSharedConnection, refreshSharedConnection, rescheduleTaskIfNecessary, resumePausedTasks, runningAllowed, setAutoStartup, setBeanName, setClientId, sharedConnectionEnabled, shutdown, start, startSharedConnection, stop, stopSharedConnection, validateConfiguration |
| Methods from org.springframework.jms.support.destination.JmsDestinationAccessor: |
|---|
| getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain |
| Methods from org.springframework.jms.support.JmsAccessor: |
|---|
| afterPropertiesSet, convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.jms.listener.AbstractMessageListenerContainer Detail: |
|---|
By default, only a standard JMS MessageListener object or a Spring SessionAwareMessageListener object will be accepted. |
|
|
Default implementation performs a plain invocation of the
|
|
|
|
null
if the configured destination is not an actual Destination type;
c.f. when the destination is a String . |
null). |
null if the configured destination is not a
String type; c.f. when
is an actual Destination . |
|
|
|
null if none). |
The default implementation logs the exception at error level, not propagating it to the JMS provider - assuming that all handling of acknowledgement and/or transactions is done by this listener container. This can be overridden in subclasses. |
|
|
|
|
Note: The Session's own transacted flag will already have been checked before. This method is about finding out whether the Session's transaction is local or externally coordinated. |
|
|
|
Default is "false", rejecting such messages through aborting the receive attempt. Switch this flag on to fully process such messages even in the stopping phase, with the drawback that even newly sent messages might still get processed (if coming in before all receive timeouts have expired). NOTE: Aborting receive attempts for such incoming messages might lead to the provider's retry count decreasing for the affected messages. If you have a high number of concurrent consumers, make sure that the number of retries is higher than the number of consumers, to be on the safe side for all potential stopping scenarios. |
Alternatively, specify a "destinationName", to be dynamically resolved via the org.springframework.jms.support.destination.DestinationResolver . Note: The destination may be replaced at runtime, with the listener container picking up the new destination immediately (works e.g. with DefaultMessageListenerContainer, as long as the cache level is less than CACHE_CONSUMER). However, this is considered advanced usage; use it with care! |
The specified name will be dynamically resolved via the configured destination resolver . Alternatively, specify a JMS Destination object as "destination". Note: The destination may be replaced at runtime, with the listener container picking up the new destination immediately (works e.g. with DefaultMessageListenerContainer, as long as the cache level is less than CACHE_CONSUMER). However, this is considered advanced usage; use it with care! |
The durable subscription name needs to be unique within this client's JMS client id. Default is the class name of the specified message listener. Note: Only 1 concurrent consumer (which is the default of this message listener container) is allowed for each durable subscription. |
|
Default is "true", reusing the listener's Session . Turn this off to expose a fresh JMS Session fetched from the same underlying JMS Connection instead, which might be necessary on some JMS providers. Note that Sessions managed by an external transaction manager will always get exposed to org.springframework.jms.core.JmsTemplate calls. So in terms of JmsTemplate exposure, this setting only affects locally transacted Sessions. |
Note: The message listener may be replaced at runtime, with the listener container picking up the new listener object immediately (works e.g. with DefaultMessageListenerContainer, as long as the cache level is less than CACHE_CONSUMER). However, this is considered advanced usage; use it with care! |
null if none).
Default is none.
See the JMS specification for a detailed definition of selector expressions. Note: The message selector may be replaced at runtime, with the listener container picking up the new selector value immediately (works e.g. with DefaultMessageListenerContainer, as long as the cache level is less than CACHE_CONSUMER). However, this is considered advanced usage; use it with care! |
Default is "false". Set this to "true" to register a durable subscription, typically in combination with a "durableSubscriptionName" value (unless your message listener class name is good enough as subscription name). Only makes sense when listening to a topic (pub-sub domain). |
|