Class JmsGatewaySupport
java.lang.Object
org.springframework.jms.core.support.JmsGatewaySupport
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
public abstract class JmsGatewaySupport
extends Object
implements org.springframework.beans.factory.InitializingBean
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(jakarta.jms.ConnectionFactory)
method.
- Since:
- 1.1.1
- Author:
- Mark Pollack
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.apache.commons.logging.Log
Logger available to subclasses. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
protected JmsTemplate
createJmsTemplate
(ConnectionFactory connectionFactory) Create a JmsTemplate for the given ConnectionFactory.final ConnectionFactory
Return the JMS ConnectionFactory used by the gateway.final JmsTemplate
Return the JmsTemplate for the gateway.protected void
Subclasses can override this for custom initialization behavior.final void
setConnectionFactory
(ConnectionFactory connectionFactory) Set the JMS connection factory to be used by the gateway.final void
setJmsTemplate
(JmsTemplate jmsTemplate) Set the JmsTemplate for the gateway.
-
Field Details
-
logger
protected final org.apache.commons.logging.Log loggerLogger available to subclasses.
-
-
Constructor Details
-
JmsGatewaySupport
public JmsGatewaySupport()
-
-
Method Details
-
setConnectionFactory
Set the JMS connection factory to be used by the gateway. Will automatically create a JmsTemplate for the given ConnectionFactory. -
createJmsTemplate
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
- the JMS ConnectionFactory to create a JmsTemplate for- Returns:
- the new JmsTemplate instance
- See Also:
-
getConnectionFactory
Return the JMS ConnectionFactory used by the gateway. -
setJmsTemplate
Set the JmsTemplate for the gateway. -
getJmsTemplate
Return the JmsTemplate for the gateway. -
afterPropertiesSet
public final void afterPropertiesSet() throws IllegalArgumentException, org.springframework.beans.factory.BeanInitializationException- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
IllegalArgumentException
org.springframework.beans.factory.BeanInitializationException
-
initGateway
Subclasses can override this for custom initialization behavior. Gets called after population of this instance's bean properties.- Throws:
Exception
- if initialization fails
-