public class PooledChannelConnectionFactory extends AbstractConnectionFactory implements com.rabbitmq.client.ShutdownListener
GenericObjectPool
s (one for transactional and one for non-transactional
channels). The pools have default configuration but they can be configured using
a callback.AbstractConnectionFactory.AddressShuffleMode
DEFAULT_CLOSE_TIMEOUT, logger
Constructor and Description |
---|
PooledChannelConnectionFactory(com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectionListener(ConnectionListener listener) |
Connection |
createConnection() |
void |
destroy() |
boolean |
isSimplePublisherConfirms()
Return true if simple publisher confirms are enabled.
|
void |
resetConnection()
Close the connection(s).
|
void |
setPoolConfigurer(BiConsumer<org.apache.commons.pool2.impl.GenericObjectPool<com.rabbitmq.client.Channel>,Boolean> poolConfigurer)
Add a consumer to configure the object pool.
|
void |
setPublisherConnectionFactory(AbstractConnectionFactory publisherConnectionFactory)
Set a custom publisher connection factory; the type does not need to be the same
as this factory.
|
void |
setSimplePublisherConfirms(boolean simplePublisherConfirms)
Enable simple publisher confirms.
|
addChannelListener, clearConnectionListeners, createBareConnection, doSetPublisherConnectionFactory, getApplicationContext, getApplicationEventPublisher, getBeanName, getChannelListener, getCloseTimeout, getConnectionListener, getConnectionNameStrategy, getContextStopped, getDefaultHostName, getExecutorService, getHost, getPort, getPublisherConnectionFactory, getRabbitConnectionFactory, getUsername, getVirtualHost, hasPublisherConnectionFactory, onApplicationEvent, removeConnectionListener, setAddresses, setAddressResolver, setAddressShuffleMode, setApplicationContext, setApplicationEventPublisher, setBeanName, setChannelListeners, setCloseExceptionLogger, setCloseTimeout, setConnectionListeners, setConnectionNameStrategy, setConnectionThreadFactory, setConnectionTimeout, setExecutor, setHost, setPassword, setPort, setRecoveryListener, setRequestedHeartBeat, setShuffleAddresses, setUri, setUri, setUsername, setVirtualHost, shutdownCompleted, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isPublisherConfirms, isPublisherReturns
forPayload
public PooledChannelConnectionFactory(com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory)
rabbitConnectionFactory
- the rabbitmq connection factory.public void setPublisherConnectionFactory(@Nullable AbstractConnectionFactory publisherConnectionFactory)
AbstractConnectionFactory
setPublisherConnectionFactory
in class AbstractConnectionFactory
publisherConnectionFactory
- the factory.public void setPoolConfigurer(BiConsumer<org.apache.commons.pool2.impl.GenericObjectPool<com.rabbitmq.client.Channel>,Boolean> poolConfigurer)
poolConfigurer
- the configurer.public boolean isSimplePublisherConfirms()
ConnectionFactory
isSimplePublisherConfirms
in interface ConnectionFactory
public void setSimplePublisherConfirms(boolean simplePublisherConfirms)
simplePublisherConfirms
- true to enable.public void addConnectionListener(ConnectionListener listener)
addConnectionListener
in interface ConnectionFactory
addConnectionListener
in class AbstractConnectionFactory
public Connection createConnection() throws AmqpException
createConnection
in interface ConnectionFactory
AmqpException
public void resetConnection()
public void destroy()
destroy
in interface DisposableBean
destroy
in class AbstractConnectionFactory