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.
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() |
RabbitTemplate |
getRabbitTemplate()
Deprecated.
- use
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 rabbitTemplate)
Set the RabbitTemplate for the gateway.
|
void |
setRabbitTemplate(RabbitTemplate rabbitTemplate)
Deprecated.
|
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()
@Deprecated public final void setRabbitTemplate(RabbitTemplate rabbitTemplate)
setRabbitOperations(RabbitOperations)
rabbitTemplate
- The Rabbit template.setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
public final void setRabbitOperations(RabbitOperations rabbitTemplate)
rabbitTemplate
- The Rabbit template.setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory)
@Deprecated public final RabbitTemplate getRabbitTemplate()
getRabbitOperations()
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