Interface ChannelPool

All Superinterfaces:
io.micronaut.core.naming.Named
All Known Implementing Classes:
DefaultChannelPool

public interface ChannelPool extends io.micronaut.core.naming.Named
A pool of Channels to allow for channels to be shared across threads but not at the same time. A channel retrieved from the pool should not be accessible to any other threads until the channel is returned from the pool.
Since:
1.1.0
Author:
James Kleeh
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default delay to apply for recovery channel getter.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.rabbitmq.client.Channel
    Retrieves a channel from the pool.
    default com.rabbitmq.client.Channel
    getChannelWithRecoveringDelay(int recoveryAttempts)
    Retrieves a channel from the pool after blocking the thread for a delay period defined by the RecoveryDelayHandler of the connection for this pool.
    default boolean
    Returns whether topology recovery is enabled for the connection of this pool.
    void
    returnChannel(com.rabbitmq.client.Channel channel)
    Returns a channel to the pool.

    Methods inherited from interface io.micronaut.core.naming.Named

    getName
  • Field Details

    • DEFAULT_RECOVERY_DELAY

      static final int DEFAULT_RECOVERY_DELAY
      The default delay to apply for recovery channel getter.
      See Also:
  • Method Details

    • getChannel

      com.rabbitmq.client.Channel getChannel() throws IOException
      Retrieves a channel from the pool. The channel must be returned to the pool after it is no longer being used.
      Returns:
      The channel
      Throws:
      IOException - If a channel needed to be created and encountered an error
    • getChannelWithRecoveringDelay

      default com.rabbitmq.client.Channel getChannelWithRecoveringDelay(int recoveryAttempts) throws IOException, InterruptedException
      Retrieves a channel from the pool after blocking the thread for a delay period defined by the RecoveryDelayHandler of the connection for this pool.
      Parameters:
      recoveryAttempts - the number of recovery attempts so far
      Returns:
      a channel from the pool
      Throws:
      IOException - if a channel needed to be created and encountered an error
      InterruptedException - if the thread was interrupted during the delay period
    • isTopologyRecoveryEnabled

      default boolean isTopologyRecoveryEnabled()
      Returns whether topology recovery is enabled for the connection of this pool.
      Returns:
      true by default
    • returnChannel

      void returnChannel(com.rabbitmq.client.Channel channel)
      Returns a channel to the pool. No further use of the channel is allowed by the returner.
      Parameters:
      channel - The channel