Class RabbitGatewaySupport
java.lang.Object
org.springframework.amqp.rabbit.core.RabbitGatewaySupport
- All Implemented Interfaces:
InitializingBean
Convenient super class for application classes that need RabbitMQ access.
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.
- Author:
- Mark Pollack, Gary Russell
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidprotected RabbitTemplatecreateRabbitTemplate(ConnectionFactory connectionFactory) Create a RabbitTemplate for the given ConnectionFactory.final ConnectionFactoryfinal RabbitOperationsprotected voidSubclasses can override this for custom initialization behavior.final voidsetConnectionFactory(ConnectionFactory connectionFactory) Set the Rabbit connection factory to be used by the gateway.final voidsetRabbitOperations(RabbitOperations rabbitOperations) Set theRabbitOperationsfor the gateway.
-
Field Details
-
logger
Logger available to subclasses.
-
-
Constructor Details
-
RabbitGatewaySupport
public RabbitGatewaySupport()
-
-
Method Details
-
setConnectionFactory
Set the Rabbit connection factory to be used by the gateway. Will automatically create a RabbitTemplate for the given ConnectionFactory.- Parameters:
connectionFactory- The connection factory.- See Also:
-
createRabbitTemplate
Create a RabbitTemplate for the given ConnectionFactory. Only invoked if populating the gateway with a ConnectionFactory reference.- Parameters:
connectionFactory- the Rabbit ConnectionFactory to create a RabbitTemplate for- Returns:
- the new RabbitTemplate instance
- See Also:
-
getConnectionFactory
- Returns:
- The Rabbit ConnectionFactory used by the gateway.
-
setRabbitOperations
Set theRabbitOperationsfor the gateway.- Parameters:
rabbitOperations- The Rabbit operations.- See Also:
-
getRabbitOperations
- Returns:
- The
RabbitOperationsfor the gateway.
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
IllegalArgumentExceptionBeanInitializationException
-
initGateway
protected void initGateway()Subclasses can override this for custom initialization behavior. Gets called after population of this instance's bean properties.
-