public class ChannelPool extends Object
ChannelPoolKey.
- Cleans up idle or closed channels periodically.
- Integrates with Mule's Scheduler for resource management.
Example usage:
ChannelPool pool = ChannelPool.getInstance(connection, schedulerService);
MuleAmqpChannel channel = pool.getChannel(channelManager, transactionalAction, qualityOfService, true);
pool.releaseChannel(channel);
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_CHANNEL |
| Modifier and Type | Method and Description |
|---|---|
MuleAmqpChannel |
getChannel(AmqpChannelManager channelManager,
org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction,
QualityOfService qualityOfService,
boolean singleMessageChannel)
Retrieves an available channel from the pool or creates a new one if necessary.
|
static ChannelPool |
getInstance(AmqpTransactionalConnection connection,
org.mule.runtime.api.scheduler.SchedulerService schedulerService)
Retrieves or creates a singleton instance of
ChannelPool for the specified connection. |
void |
releaseChannel(AmqpChannelManager channelManager,
org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction,
QualityOfService qualityOfService,
boolean singleMessageChannel,
MuleAmqpChannel channel)
Releases a channel back to the pool for reuse or closes it if no longer valid.
|
public static final int DEFAULT_MAX_CHANNEL
public static ChannelPool getInstance(AmqpTransactionalConnection connection, org.mule.runtime.api.scheduler.SchedulerService schedulerService)
ChannelPool for the specified connection.connection - The AMQP connection for which the pool is managed.schedulerService - Mule's scheduler service for managing periodic tasks.ChannelPool.IOException - If an error occurs during initialization.public MuleAmqpChannel getChannel(AmqpChannelManager channelManager, org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction, QualityOfService qualityOfService, boolean singleMessageChannel) throws IOException
channelManager - The channel manager responsible for managing channel lifecycles.transactionalAction - The transactional action associated with the operation.qualityOfService - Quality of Service (QoS) settings for the channel.singleMessageChannel - Whether the channel is intended for single-message operations.MuleAmqpChannel ready for use.IOException - If the maximum number of channels is reached or channel creation fails.public void releaseChannel(AmqpChannelManager channelManager, org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction, QualityOfService qualityOfService, boolean singleMessageChannel, MuleAmqpChannel channel)
channel - The MuleAmqpChannel to be released.
If the channel is invalid (e.g., closed), it will be discarded.Copyright © 2025 MuleSoft, Inc.. All rights reserved.