Package io.micronaut.rabbitmq.connect
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
FieldsModifier and TypeFieldDescriptionstatic final intThe default delay to apply for recovery channel getter. - 
Method Summary
Modifier and TypeMethodDescriptioncom.rabbitmq.client.ChannelRetrieves a channel from the pool.default com.rabbitmq.client.ChannelgetChannelWithRecoveringDelay(int recoveryAttempts) Retrieves a channel from the pool after blocking the thread for a delay period defined by theRecoveryDelayHandlerof the connection for this pool.default booleanReturns whethertopology recoveryis enabled for the connection of this pool.voidreturnChannel(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_DELAYThe default delay to apply for recovery channel getter.- See Also:
 
 
 - 
 - 
Method Details
- 
getChannel
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 theRecoveryDelayHandlerof 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 errorInterruptedException- if the thread was interrupted during the delay period
 - 
isTopologyRecoveryEnabled
default boolean isTopologyRecoveryEnabled()Returns whethertopology recoveryis 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
 
 -