public abstract class JmsGatewaySupport extends Object implements InitializingBean
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.
setConnectionFactory(javax.jms.ConnectionFactory)
,
setJmsTemplate(org.springframework.jms.core.JmsTemplate)
,
createJmsTemplate(javax.jms.ConnectionFactory)
,
JmsTemplate
Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses.
|
Constructor and Description |
---|
JmsGatewaySupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
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.
|
protected final Log logger
public final void setConnectionFactory(ConnectionFactory connectionFactory)
protected JmsTemplate createJmsTemplate(ConnectionFactory connectionFactory)
Can be overridden in subclasses to provide a JmsTemplate instance with a different configuration.
connectionFactory
- the JMS ConnectionFactory to create a JmsTemplate forsetConnectionFactory(javax.jms.ConnectionFactory)
@Nullable public final ConnectionFactory getConnectionFactory()
public final void setJmsTemplate(@Nullable JmsTemplate jmsTemplate)
@Nullable public final JmsTemplate getJmsTemplate()
public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException
InitializingBean
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.
afterPropertiesSet
in interface InitializingBean
IllegalArgumentException
BeanInitializationException