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 Object implements InitializingBean
Author:
Mark Fisher, Dave Syer, Gary Russell
  • Field Details

    • logger

      protected final Log 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

      public void setConnectionFactory(ConnectionFactory connectionFactory)
      Set the ConnectionFactory to use for obtaining RabbitMQ Connections.
      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:
      afterPropertiesSet in interface InitializingBean
    • 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:
    • 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 null if 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 null if none found
    • getTransactionalResourceHolder

      protected RabbitResourceHolder getTransactionalResourceHolder()
    • convertRabbitAccessException

      protected RuntimeException convertRabbitAccessException(Exception ex)