public class RabbitGatewaySupport
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean
Requires a ConnectionFactory or a RabbitTemplate instance to be set.
It will create its own RabbitTemplate if a ConnectionFactory is passed in.
A custom RabbitTemplate instance can be created for a given ConnectionFactory
through overriding the createRabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory)
method.
setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
,
setRabbitOperations(org.springframework.amqp.rabbit.core.RabbitOperations)
,
createRabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory)
,
RabbitTemplate
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses.
|
Constructor and Description |
---|
RabbitGatewaySupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected RabbitTemplate |
createRabbitTemplate(ConnectionFactory connectionFactory)
Create a RabbitTemplate for the given ConnectionFactory.
|
ConnectionFactory |
getConnectionFactory() |
RabbitOperations |
getRabbitOperations() |
protected void |
initGateway()
Subclasses can override this for custom initialization behavior.
|
void |
setConnectionFactory(ConnectionFactory connectionFactory)
Set the Rabbit connection factory to be used by the gateway.
|
void |
setRabbitOperations(RabbitOperations rabbitOperations)
Set the
RabbitOperations for the gateway. |
protected final org.apache.commons.logging.Log logger
public final void setConnectionFactory(ConnectionFactory connectionFactory)
connectionFactory
- The connection factory.createRabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory)
,
setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
protected RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory)
connectionFactory
- the Rabbit ConnectionFactory to create a RabbitTemplate forsetConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
public final ConnectionFactory getConnectionFactory()
public final void setRabbitOperations(RabbitOperations rabbitOperations)
RabbitOperations
for the gateway.rabbitOperations
- The Rabbit operations.setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
public final RabbitOperations getRabbitOperations()
RabbitOperations
for the gateway.public final void afterPropertiesSet() throws java.lang.IllegalArgumentException, org.springframework.beans.factory.BeanInitializationException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.IllegalArgumentException
org.springframework.beans.factory.BeanInitializationException
protected void initGateway() throws java.lang.Exception
java.lang.Exception
- if initialization fails