Class JmsMessageEndpointManager

java.lang.Object
org.springframework.jca.endpoint.GenericMessageEndpointManager
org.springframework.jms.listener.endpoint.JmsMessageEndpointManager
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, MessageListenerContainer

public class JmsMessageEndpointManager extends org.springframework.jca.endpoint.GenericMessageEndpointManager implements org.springframework.beans.factory.BeanNameAware, MessageListenerContainer
Extension of the generic JCA 1.5 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:
  • Constructor Details

    • JmsMessageEndpointManager

      public JmsMessageEndpointManager()
  • Method Details

    • setMessageListener

      public void setMessageListener(jakarta.jms.MessageListener messageListener)
      Set the JMS MessageListener for this endpoint.

      This is a shortcut for configuring a dedicated JmsMessageEndpointFactory.

      See Also:
    • getMessageListener

      public jakarta.jms.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 plain TransactionManager.

      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.

      See Also:
      • AbstractMessageEndpointFactory.setTransactionManager(Object)
    • setActivationSpecFactory

      public void setActivationSpecFactory(@Nullable JmsActivationSpecFactory activationSpecFactory)
      Set the factory for concrete JCA 1.5 ActivationSpec objects, creating JCA ActivationSpecs based on JmsActivationSpecConfig objects.

      This factory is dependent on the concrete JMS provider, for example, on ActiveMQ. The default implementation simply guesses the ActivationSpec class name from the provider's class name (for example, "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

      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(DestinationResolver)). This is simply a shortcut for parameterizing the default JmsActivationSpecFactory; it will replace any custom JmsActivationSpecFactory that might have been set before.

      See Also:
    • setActivationSpecConfig

      public void setActivationSpecConfig(@Nullable JmsActivationSpecConfig activationSpecConfig)
      Specify the JmsActivationSpecConfig 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 @Nullable JmsActivationSpecConfig getActivationSpecConfig()
      Return the JmsActivationSpecConfig object that this endpoint manager should use for activating its listener. Return null 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.
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws jakarta.resource.ResourceException
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.springframework.jca.endpoint.GenericMessageEndpointManager
      Throws:
      jakarta.resource.ResourceException
    • setupMessageListener

      public void setupMessageListener(Object messageListener)
      Description copied from interface: MessageListenerContainer
      Set up the message listener to use. Throws an IllegalArgumentException if that message listener type is not supported.
      Specified by:
      setupMessageListener in interface MessageListenerContainer
    • getMessageConverter

      public @Nullable MessageConverter getMessageConverter()
      Description copied from interface: MessageListenerContainer
      Return the MessageConverter that can be used to convert Message, if any.
      Specified by:
      getMessageConverter in interface MessageListenerContainer
    • getDestinationResolver

      public @Nullable DestinationResolver getDestinationResolver()
      Description copied from interface: MessageListenerContainer
      Return the DestinationResolver to use to resolve destinations by names.
      Specified by:
      getDestinationResolver in interface MessageListenerContainer
    • isPubSubDomain

      public boolean isPubSubDomain()
      Description copied from interface: MessageListenerContainer
      Return whether the Publish/Subscribe domain (Topics) is used. Otherwise, the Point-to-Point domain (Queues) is used.
      Specified by:
      isPubSubDomain in interface MessageListenerContainer
    • isReplyPubSubDomain

      public boolean isReplyPubSubDomain()
      Description copied from interface: 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().

      Specified by:
      isReplyPubSubDomain in interface MessageListenerContainer
    • getReplyQosSettings

      public @Nullable QosSettings getReplyQosSettings()
      Description copied from interface: MessageListenerContainer
      Return the QosSettings to use when sending a reply, or null if the broker's defaults should be used.
      Specified by:
      getReplyQosSettings in interface MessageListenerContainer