Class JmsMessageEndpointManager
- All Implemented Interfaces:
Aware,BeanNameAware,DisposableBean,InitializingBean,Lifecycle,Phased,SmartLifecycle,MessageListenerContainer
GenericMessageEndpointManager,
adding JMS-specific support for ActivationSpec configuration.
Allows for defining a common JmsActivationSpecConfig object
that gets converted into a provider-specific JCA 1.5 ActivationSpec
object for activating the endpoint.
NOTE: This JCA-based endpoint manager supports standard JMS
MessageListener endpoints only. It does not support
Spring's SessionAwareMessageListener
variant, simply because the JCA endpoint management contract does not allow
for obtaining the current JMS Session.
- Since:
- 2.5
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPrepares the message endpoint, and automatically activates it if the "autoStartup" flag is set to "true".Return theJmsActivationSpecConfigobject that this endpoint manager should use for activating its listener.Return theDestinationResolverto use to resolve destinations by names.Return theMessageConverterthat can be used to convertMessage, if any.Return the JMS MessageListener for this endpoint.Return theQosSettingsto use when sending a reply, ornullif the broker's defaults should be used.booleanReturn whether the Publish/Subscribe domain (Topics) is used.booleanReturn whether the reply destination uses Publish/Subscribe domain (Topics).voidsetActivationSpecConfig(JmsActivationSpecConfig activationSpecConfig) Specify theJmsActivationSpecConfigobject that this endpoint manager should use for activating its listener.voidsetActivationSpecFactory(JmsActivationSpecFactory activationSpecFactory) Set the factory for concrete JCA 1.5 ActivationSpec objects, creating JCA ActivationSpecs based onJmsActivationSpecConfigobjects.voidsetBeanName(String beanName) Set the name of this message endpoint.voidsetDestinationResolver(DestinationResolver destinationResolver) Set the DestinationResolver to use for resolving destination names into the JCA 1.5 ActivationSpec "destination" property.voidsetMessageListener(MessageListener messageListener) Set the JMS MessageListener for this endpoint.voidsetTransactionManager(Object transactionManager) Set the XA transaction manager to use for wrapping endpoint invocations, enlisting the endpoint resource in each such transaction.voidsetupMessageListener(Object messageListener) Setup the message listener to use.Methods inherited from class org.springframework.jca.endpoint.GenericMessageEndpointManager
destroy, getActivationSpec, getMessageEndpointFactory, getPhase, getResourceAdapter, isAutoStartup, isRunning, setActivationSpec, setAutoStartup, setMessageEndpointFactory, setPhase, setResourceAdapter, start, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Constructor Details
-
JmsMessageEndpointManager
public JmsMessageEndpointManager()
-
-
Method Details
-
setMessageListener
Set the JMS MessageListener for this endpoint.This is a shortcut for configuring a dedicated JmsMessageEndpointFactory.
-
getMessageListener
Return the JMS MessageListener for this endpoint. -
setTransactionManager
Set the XA transaction manager to use for wrapping endpoint invocations, enlisting the endpoint resource in each such transaction.The passed-in object may be a transaction manager which implements Spring's
TransactionFactoryinterface, or a plainTransactionManager.If no transaction manager is specified, the endpoint invocation will simply not be wrapped in an XA transaction. Consult your resource provider's ActivationSpec documentation for the local transaction options of your particular provider.
This is a shortcut for configuring a dedicated JmsMessageEndpointFactory.
-
setActivationSpecFactory
Set the factory for concrete JCA 1.5 ActivationSpec objects, creating JCA ActivationSpecs based onJmsActivationSpecConfigobjects.This factory is dependent on the concrete JMS provider, e.g. on ActiveMQ. The default implementation simply guesses the ActivationSpec class name from the provider's class name (e.g. "ActiveMQResourceAdapter" → "ActiveMQActivationSpec" in the same package), and populates the ActivationSpec properties as suggested by the JCA 1.5 specification (plus a couple of autodetected vendor-specific properties).
- See Also:
-
setDestinationResolver
Set the DestinationResolver to use for resolving destination names into the JCA 1.5 ActivationSpec "destination" property.If not specified, destination names will simply be passed in as Strings. If specified, destination names will be resolved into Destination objects first.
Note that a DestinationResolver is usually specified on the JmsActivationSpecFactory (see
StandardJmsActivationSpecFactory.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver)). This is simply a shortcut for parameterizing the default JmsActivationSpecFactory; it will replace any custom JmsActivationSpecFactory that might have been set before. -
setActivationSpecConfig
Specify theJmsActivationSpecConfigobject that this endpoint manager should use for activating its listener.This config object will be turned into a concrete JCA 1.5 ActivationSpec object through a
JmsActivationSpecFactory. -
getActivationSpecConfig
Return theJmsActivationSpecConfigobject that this endpoint manager should use for activating its listener. Returnnullif none is set. -
setBeanName
Set the name of this message endpoint. Populated with the bean name automatically when defined within Spring's bean factory.- Specified by:
setBeanNamein interfaceBeanNameAware- Parameters:
beanName- the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use theBeanFactoryUtils.originalBeanName(String)method to extract the original bean name (without suffix), if desired.
-
afterPropertiesSet
Description copied from class:GenericMessageEndpointManagerPrepares the message endpoint, and automatically activates it if the "autoStartup" flag is set to "true".- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classGenericMessageEndpointManager- Throws:
ResourceException
-
setupMessageListener
Description copied from interface:MessageListenerContainerSetup the message listener to use. Throws anIllegalArgumentExceptionif that message listener type is not supported.- Specified by:
setupMessageListenerin interfaceMessageListenerContainer
-
getMessageConverter
Description copied from interface:MessageListenerContainerReturn theMessageConverterthat can be used to convertMessage, if any.- Specified by:
getMessageConverterin interfaceMessageListenerContainer
-
getDestinationResolver
Description copied from interface:MessageListenerContainerReturn theDestinationResolverto use to resolve destinations by names.- Specified by:
getDestinationResolverin interfaceMessageListenerContainer
-
isPubSubDomain
public boolean isPubSubDomain()Description copied from interface:MessageListenerContainerReturn whether the Publish/Subscribe domain (Topics) is used. Otherwise, the Point-to-Point domain (Queues) is used.- Specified by:
isPubSubDomainin interfaceMessageListenerContainer
-
isReplyPubSubDomain
public boolean isReplyPubSubDomain()Description copied from interface:MessageListenerContainerReturn whether the reply destination uses Publish/Subscribe domain (Topics). Otherwise, the Point-to-Point domain (Queues) is used.By default, the value is identical to
MessageListenerContainer.isPubSubDomain().- Specified by:
isReplyPubSubDomainin interfaceMessageListenerContainer
-
getReplyQosSettings
Description copied from interface:MessageListenerContainerReturn theQosSettingsto use when sending a reply, ornullif the broker's defaults should be used.- Specified by:
getReplyQosSettingsin interfaceMessageListenerContainer
-