public class RabbitGatewaySupport extends Object implements 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 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 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)
@Nullable 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 IllegalArgumentException, BeanInitializationException
afterPropertiesSet
in interface InitializingBean
IllegalArgumentException
BeanInitializationException
protected void initGateway()