Top Description Fields Constructors Methods
org.springframework.jms.core.support

public abstract Class JmsGatewaySupport

extends Object
implements InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean
Imports
jakarta.jms.ConnectionFactory, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.BeanInitializationException, .InitializingBean, org.springframework.jms.core.JmsTemplate, org.springframework.lang.Nullable

Convenient superclass 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 method.

Author
Mark Pollack
Since
1.1.1
See Also
setConnectionFactory, setJmsTemplate, createJmsTemplate, org.springframework.jms.core.JmsTemplate

Field Summary

Modifier and TypeField and Description
private JmsTemplate
protected final Log
logger

Logger available to subclasses.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

protected JmsTemplate

Returns:

the new JmsTemplate instance
createJmsTemplate
(ConnectionFactory
the JMS ConnectionFactory to create a JmsTemplate for
connectionFactory
)

Create a JmsTemplate for the given ConnectionFactory.

public final ConnectionFactory
getConnectionFactory()

Return the JMS ConnectionFactory used by the gateway.

public final JmsTemplate
getJmsTemplate()

Return the JmsTemplate for the gateway.

protected void
initGateway()

Subclasses can override this for custom initialization behavior.

public final void
setConnectionFactory(ConnectionFactory connectionFactory)

Set the JMS connection factory to be used by the gateway.

public final void
setJmsTemplate(JmsTemplate jmsTemplate)

Set the JmsTemplate for the gateway.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jmsTemplateback to summary
private JmsTemplate jmsTemplate
Annotations
@Nullable
loggerback to summary
protected final Log logger

Logger available to subclasses.

Constructor Detail

JmsGatewaySupportback to summary
public JmsGatewaySupport()

Method Detail

afterPropertiesSetback to summary
public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
createJmsTemplateback to summary
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.

Parameters
connectionFactory:ConnectionFactory

the JMS ConnectionFactory to create a JmsTemplate for

Returns:JmsTemplate

the new JmsTemplate instance

See Also
setConnectionFactory
getConnectionFactoryback to summary
public final ConnectionFactory getConnectionFactory()

Return the JMS ConnectionFactory used by the gateway.

Annotations
@Nullable
getJmsTemplateback to summary
public final JmsTemplate getJmsTemplate()

Return the JmsTemplate for the gateway.

Annotations
@Nullable
initGatewayback to summary
protected void initGateway() throws Exception

Subclasses can override this for custom initialization behavior. Gets called after population of this instance's bean properties.

Exceptions
Exception:
if initialization fails
setConnectionFactoryback to summary
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.

See Also
createJmsTemplate, setConnectionFactory(jakarta.jms.ConnectionFactory)
setJmsTemplateback to summary
public final void setJmsTemplate(JmsTemplate jmsTemplate)

Set the JmsTemplate for the gateway.

See Also
setConnectionFactory(jakarta.jms.ConnectionFactory)