public abstract class JmsGatewaySupport extends java.lang.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(ConnectionFactory)
method.
setConnectionFactory(ConnectionFactory)
,
setJmsTemplate(org.springframework.jms.core.JmsTemplate)
,
createJmsTemplate(ConnectionFactory)
,
JmsTemplate
Modifier and Type | Field and Description |
---|---|
private JmsTemplate |
jmsTemplate |
protected Log |
logger
Logger available to subclasses
|
Constructor and Description |
---|
JmsGatewaySupport() |
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.
|
protected final Log logger
private JmsTemplate jmsTemplate
public final void setConnectionFactory(ConnectionFactory connectionFactory)
connectionFactory
- createJmsTemplate(ConnectionFactory)
,
#setConnectionFactory(javax.jms.ConnectionFactory)
protected JmsTemplate createJmsTemplate(ConnectionFactory connectionFactory)
Can be overridden in subclasses to provide a JmsTemplate instance with a different configuration or the JMS 1.0.2 version, JmsTemplate102.
connectionFactory
- the JMS ConnectionFactory to create a JmsTemplate forsetConnectionFactory(ConnectionFactory)
,
JmsTemplate102
public final ConnectionFactory getConnectionFactory()
public final void setJmsTemplate(JmsTemplate jmsTemplate)
jmsTemplate
- #setConnectionFactory(javax.jms.ConnectionFactory)
public final JmsTemplate getJmsTemplate()
public final void afterPropertiesSet() throws java.lang.IllegalArgumentException, BeanInitializationException
InitializingBean
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.
afterPropertiesSet
in interface InitializingBean
java.lang.IllegalArgumentException
BeanInitializationException
protected void initGateway() throws java.lang.Exception
java.lang.Exception
- if initialization fails