JmsGatewaySupport (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.jms.core.support

## Class JmsGatewaySupport

- java.lang.Object
- - org.springframework.jms.core.support.JmsGatewaySupport

- All Implemented Interfaces:
    InitializingBean

      public abstract class JmsGatewaySupport
      extends Object
      implements InitializingBean

  Convenient super class for application classes that need JMS access.

  Requires a ConnectionFactory or a JmsTemplate instance to be set. It will create its own JmsTemplate if a ConnectionFactory is passed in. A custom JmsTemplate instance can be created for a given ConnectionFactory through overriding the `createJmsTemplate(javax.jms.ConnectionFactory)` method.

  Since:
    1.1.1
  Author:
    Mark Pollack
  See Also:
    `setConnectionFactory(javax.jms.ConnectionFactory)`, `setJmsTemplate(org.springframework.jms.core.JmsTemplate)`, `createJmsTemplate(javax.jms.ConnectionFactory)`, `JmsTemplate`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `logger` Logger available to subclasses

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JmsGatewaySupport()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
    `protected JmsTemplate` | `createJmsTemplate(ConnectionFactory connectionFactory)` Create a JmsTemplate for the given ConnectionFactory.
    `ConnectionFactory` | `getConnectionFactory()` Return the JMS ConnectionFactory used by the gateway.
    `JmsTemplate` | `getJmsTemplate()` Return the JmsTemplate for the gateway.
    `protected void` | `initGateway()` Subclasses can override this for custom initialization behavior.
    `void` | `setConnectionFactory(ConnectionFactory connectionFactory)` Set the JMS connection factory to be used by the gateway.
    `void` | `setJmsTemplate(JmsTemplate jmsTemplate)` Set the JmsTemplate for the gateway.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final Log logger

      Logger available to subclasses

  - ### Constructor Detail

    - #### JmsGatewaySupport

          public JmsGatewaySupport()

  - ### Method Detail

    - #### setConnectionFactory

          public final void setConnectionFactory(ConnectionFactory connectionFactory)

      Set the JMS connection factory to be used by the gateway. Will automatically create a JmsTemplate for the given ConnectionFactory.
      Parameters:
        `connectionFactory` -
      See Also:
        `createJmsTemplate(javax.jms.ConnectionFactory)`, `setConnectionFactory(javax.jms.ConnectionFactory)`

    - #### createJmsTemplate

          protected JmsTemplate createJmsTemplate(ConnectionFactory connectionFactory)

      Create a JmsTemplate for the given ConnectionFactory. Only invoked if populating the gateway with a ConnectionFactory reference.

      Can be overridden in subclasses to provide a JmsTemplate instance with a different configuration or the JMS 1.0.2 version, JmsTemplate102.

      Parameters:
        `connectionFactory` - the JMS ConnectionFactory to create a JmsTemplate for
      Returns:
        the new JmsTemplate instance
      See Also:
        `setConnectionFactory(javax.jms.ConnectionFactory)`, `JmsTemplate102`

    - #### getConnectionFactory

          public final ConnectionFactory getConnectionFactory()

      Return the JMS ConnectionFactory used by the gateway.

    - #### setJmsTemplate

          public final void setJmsTemplate(JmsTemplate jmsTemplate)

      Set the JmsTemplate for the gateway.
      Parameters:
        `jmsTemplate` -
      See Also:
        `setConnectionFactory(javax.jms.ConnectionFactory)`

    - #### getJmsTemplate

          public final JmsTemplate getJmsTemplate()

      Return the JmsTemplate for the gateway.

    - #### afterPropertiesSet

          public final void afterPropertiesSet()
                                        throws IllegalArgumentException,
                                               BeanInitializationException

      Description copied from interface: `InitializingBean`
      Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

      This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Throws:
        `IllegalArgumentException`
        `BeanInitializationException`

    - #### initGateway

          protected void initGateway()
                              throws Exception

      Subclasses can override this for custom initialization behavior. Gets called after population of this instance's bean properties.
      Throws:
        `Exception` - if initialization fails