Class RabbitAccessor
java.lang.Object
org.springframework.amqp.rabbit.connection.RabbitAccessor
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
ObservableListenerContainer
,RabbitTemplate
- Author:
- Mark Fisher, Dave Syer, Gary Russell
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected RuntimeException
protected Connection
Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.protected com.rabbitmq.client.Channel
getChannel
(RabbitResourceHolder holder) Fetch an appropriate Channel from the given RabbitResourceHolder.protected Connection
getConnection
(RabbitResourceHolder holder) Fetch an appropriate Connection from the given RabbitResourceHolder.protected io.micrometer.observation.ObservationRegistry
protected RabbitResourceHolder
boolean
protected void
obtainObservationRegistry
(ApplicationContext appContext) void
setChannelTransacted
(boolean transactional) Flag to indicate that channels created by this component will be transactional.void
setConnectionFactory
(ConnectionFactory connectionFactory) Set the ConnectionFactory to use for obtaining RabbitMQConnections
.
-
Field Details
-
logger
Logger available to subclasses.
-
-
Constructor Details
-
RabbitAccessor
public RabbitAccessor()
-
-
Method Details
-
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
Set the ConnectionFactory to use for obtaining RabbitMQConnections
.- Parameters:
connectionFactory
- The connection factory.
-
getConnectionFactory
- Returns:
- The ConnectionFactory that this accessor uses for obtaining RabbitMQ
Connections
.
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
createConnection
Create a RabbitMQ Connection via this template's ConnectionFactory and its host and port values.- Returns:
- the new RabbitMQ Connection
- See Also:
-
getConnection
Fetch an appropriate Connection from the given RabbitResourceHolder.- Parameters:
holder
- the RabbitResourceHolder- Returns:
- an appropriate Connection fetched from the holder, or
null
if none found
-
getChannel
Fetch an appropriate Channel from the given RabbitResourceHolder.- Parameters:
holder
- the RabbitResourceHolder- Returns:
- an appropriate Channel fetched from the holder, or
null
if none found
-
getTransactionalResourceHolder
-
convertRabbitAccessException
-
obtainObservationRegistry
-
getObservationRegistry
protected io.micrometer.observation.ObservationRegistry getObservationRegistry()
-