Class RabbitAccessor
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.RabbitAccessor
-
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
AbstractMessageListenerContainer,RabbitTemplate
public abstract class RabbitAccessor extends java.lang.Object implements InitializingBean
- Author:
- Mark Fisher, Dave Syer, Gary Russell
-
-
Constructor Summary
Constructors Constructor Description RabbitAccessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected java.lang.RuntimeExceptionconvertRabbitAccessException(java.lang.Exception ex)protected ConnectioncreateConnection()Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.protected com.rabbitmq.client.ChannelgetChannel(RabbitResourceHolder holder)Fetch an appropriate Channel from the given RabbitResourceHolder.protected ConnectiongetConnection(RabbitResourceHolder holder)Fetch an appropriate Connection from the given RabbitResourceHolder.ConnectionFactorygetConnectionFactory()protected RabbitResourceHoldergetTransactionalResourceHolder()booleanisChannelTransacted()voidsetChannelTransacted(boolean transactional)Flag to indicate that channels created by this component will be transactional.voidsetConnectionFactory(ConnectionFactory connectionFactory)Set the ConnectionFactory to use for obtaining RabbitMQConnections.
-
-
-
Field Detail
-
logger
protected final Log logger
Logger available to subclasses.
-
-
Method Detail
-
isChannelTransacted
public boolean isChannelTransacted()
-
setChannelTransacted
public void setChannelTransacted(boolean transactional)
Flag to indicate that channels created by this component will be transactional.- Parameters:
transactional- the flag value to set
-
setConnectionFactory
public void setConnectionFactory(ConnectionFactory connectionFactory)
Set the ConnectionFactory to use for obtaining RabbitMQConnections.- Parameters:
connectionFactory- The connection factory.
-
getConnectionFactory
public ConnectionFactory getConnectionFactory()
- Returns:
- The ConnectionFactory that this accessor uses for obtaining RabbitMQ
Connections.
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
createConnection
protected Connection createConnection()
Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.- Returns:
- the new RabbitMQ Connection
- See Also:
ConnectionFactory.createConnection()
-
getConnection
@Nullable protected Connection getConnection(RabbitResourceHolder holder)
Fetch an appropriate Connection from the given RabbitResourceHolder.- Parameters:
holder- the RabbitResourceHolder- Returns:
- an appropriate Connection fetched from the holder, or
nullif none found
-
getChannel
@Nullable protected com.rabbitmq.client.Channel getChannel(RabbitResourceHolder holder)
Fetch an appropriate Channel from the given RabbitResourceHolder.- Parameters:
holder- the RabbitResourceHolder- Returns:
- an appropriate Channel fetched from the holder, or
nullif none found
-
getTransactionalResourceHolder
protected RabbitResourceHolder getTransactionalResourceHolder()
-
convertRabbitAccessException
protected java.lang.RuntimeException convertRabbitAccessException(java.lang.Exception ex)
-
-