类 JmsMessageEndpointManager
- java.lang.Object
- org.springframework.jca.endpoint.GenericMessageEndpointManager
- org.springframework.jms.listener.endpoint.JmsMessageEndpointManager
- 所有已实现的接口:
Aware
,BeanNameAware
,DisposableBean
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
,MessageListenerContainer
public class JmsMessageEndpointManager extends GenericMessageEndpointManager implements BeanNameAware, MessageListenerContainer
Extension of the generic JCA 1.5GenericMessageEndpointManager
, 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'sSessionAwareMessageListener
variant, simply because the JCA endpoint management contract does not allow for obtaining the current JMSSession
.- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller, Stephane Nicoll
- 另请参阅:
MessageListener
,setActivationSpecConfig(org.springframework.jms.listener.endpoint.JmsActivationSpecConfig)
,JmsActivationSpecConfig
,JmsActivationSpecFactory
,JmsMessageEndpointFactory
构造器概要
构造器 构造器 说明 JmsMessageEndpointManager()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Prepares the message endpoint, and automatically activates it if the "autoStartup" flag is set to "true".JmsActivationSpecConfig
getActivationSpecConfig()
Return theJmsActivationSpecConfig
object that this endpoint manager should use for activating its listener.DestinationResolver
getDestinationResolver()
Return theDestinationResolver
to use to resolve destinations by names.MessageConverter
getMessageConverter()
Return theMessageConverter
that can be used to convertMessage
, if any.MessageListener
getMessageListener()
Return the JMS MessageListener for this endpoint.boolean
isPubSubDomain()
Return whether the Publish/Subscribe domain (Topics
) is used.boolean
isReplyPubSubDomain()
Return whether the reply destination uses Publish/Subscribe domain (Topics
).void
setActivationSpecConfig(JmsActivationSpecConfig activationSpecConfig)
Specify theJmsActivationSpecConfig
object that this endpoint manager should use for activating its listener.void
setActivationSpecFactory(JmsActivationSpecFactory activationSpecFactory)
Set the factory for concrete JCA 1.5 ActivationSpec objects, creating JCA ActivationSpecs based onJmsActivationSpecConfig
objects.void
setBeanName(String beanName)
Set the name of this message endpoint.void
setDestinationResolver(DestinationResolver destinationResolver)
Set the DestinationResolver to use for resolving destination names into the JCA 1.5 ActivationSpec "destination" property.void
setMessageListener(MessageListener messageListener)
Set the JMS MessageListener for this endpoint.void
setTransactionManager(Object transactionManager)
Set the XA transaction manager to use for wrapping endpoint invocations, enlisting the endpoint resource in each such transaction.void
setupMessageListener(Object messageListener)
Setup the message listener to use.从类继承的方法 org.springframework.jca.endpoint.GenericMessageEndpointManager
destroy, getActivationSpec, getMessageEndpointFactory, getPhase, getResourceAdapter, isAutoStartup, isRunning, setActivationSpec, setAutoStartup, setMessageEndpointFactory, setPhase, setResourceAdapter, start, stop, stop
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.context.SmartLifecycle
isAutoStartup, stop
构造器详细资料
JmsMessageEndpointManager
public JmsMessageEndpointManager()
方法详细资料
setMessageListener
public void setMessageListener(MessageListener messageListener)
Set the JMS MessageListener for this endpoint.This is a shortcut for configuring a dedicated JmsMessageEndpointFactory.
getMessageListener
public MessageListener getMessageListener()
Return the JMS MessageListener for this endpoint.
setTransactionManager
public void setTransactionManager(Object transactionManager)
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
TransactionFactory
interface, 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
public void setActivationSpecFactory(JmsActivationSpecFactory activationSpecFactory)
Set the factory for concrete JCA 1.5 ActivationSpec objects, creating JCA ActivationSpecs based onJmsActivationSpecConfig
objects.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).
setDestinationResolver
public void setDestinationResolver(DestinationResolver destinationResolver)
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
public void setActivationSpecConfig(JmsActivationSpecConfig activationSpecConfig)
Specify theJmsActivationSpecConfig
object 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
public JmsActivationSpecConfig getActivationSpecConfig()
Return theJmsActivationSpecConfig
object that this endpoint manager should use for activating its listener. Returnnull
if none is set.
setBeanName
public void setBeanName(String beanName)
Set the name of this message endpoint. Populated with the bean name automatically when defined within Spring's bean factory.- 指定者:
setBeanName
在接口中BeanNameAware
- 参数:
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
public void afterPropertiesSet() throws ResourceException
从类复制的说明:GenericMessageEndpointManager
Prepares the message endpoint, and automatically activates it if the "autoStartup" flag is set to "true".
setupMessageListener
public void setupMessageListener(Object messageListener)
从接口复制的说明:MessageListenerContainer
Setup the message listener to use. Throws anIllegalArgumentException
if that message listener type is not supported.
getMessageConverter
public MessageConverter getMessageConverter()
从接口复制的说明:MessageListenerContainer
Return theMessageConverter
that can be used to convertMessage
, if any.
getDestinationResolver
public DestinationResolver getDestinationResolver()
从接口复制的说明:MessageListenerContainer
Return theDestinationResolver
to use to resolve destinations by names.
isPubSubDomain
public boolean isPubSubDomain()
从接口复制的说明:MessageListenerContainer
Return whether the Publish/Subscribe domain (Topics
) is used. Otherwise, the Point-to-Point domain (Queues
) is used.- 指定者:
isPubSubDomain
在接口中MessageListenerContainer
isReplyPubSubDomain
public boolean isReplyPubSubDomain()
从接口复制的说明:MessageListenerContainer
Return 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()
.