public class Config extends Object implements ConnectionConfig
Constructor and Description |
---|
Config() |
Config(Config parent)
Creates a new Config object that inherits configuration from the
parent . |
Modifier and Type | Method and Description |
---|---|
Collection<ChannelListener> |
getChannelListeners()
Returns the channel's listeners else empty list if none were configured.
|
RecoveryPolicy |
getChannelRecoveryPolicy()
Returns the channel's recovery policy.
|
RetryPolicy |
getChannelRetryPolicy()
Returns the channel's retry policy.
|
Collection<ConnectionListener> |
getConnectionListeners()
Returns the connection's listeners else empty list if none were configured.
|
RecoveryPolicy |
getConnectionRecoveryPolicy()
Returns the connection's recovery policy.
|
RetryPolicy |
getConnectionRetryPolicy()
Returns the connection's retry policy.
|
RetryPolicy |
getConnectRetryPolicy()
Sets the policy to use for handling
connection attempt errors. |
Collection<ConsumerListener> |
getConsumerListeners()
Returns the consumer listeners else empty list if none were configured.
|
Set<Class<? extends Exception>> |
getRecoverableExceptions()
Returns the exceptions which will be recovered from.
|
Set<Class<? extends Exception>> |
getRetryableExceptions()
Returns the exceptions for which invocations will be retried.
|
boolean |
isConsumerRecoveryEnabled()
Returns whether consumer recovery is enabled.
|
boolean |
isExchangeRecoveryEnabled()
Returns whether exchange and exchange binding recovery is enabled.
|
boolean |
isQueueRecoveryEnabled()
Returns whether queue and queue binding recovery is enabled.
|
static ConfigurableChannel |
of(com.rabbitmq.client.Channel channel)
Returns the
channel as a ConfigurableChannel . |
static ConfigurableConnection |
of(com.rabbitmq.client.Connection connection)
Returns the
connection as a ConfigurableConnection . |
Config |
withChannelListeners(ChannelListener... channelListeners)
Sets the
channelListeners to call on channel related events. |
Config |
withChannelRecoveryPolicy(RecoveryPolicy channelRecoveryPolicy)
Sets the
recoveryPolicy to use for recovering the channel. |
Config |
withChannelRetryPolicy(RetryPolicy channelRetryPolicy)
Sets the
retryPolicy to use for retrying failed invocations on the channel. |
Config |
withConnectionListeners(ConnectionListener... connectionListeners)
Sets the
connectionListeners to call on connection related events. |
Config |
withConnectionRecoveryPolicy(RecoveryPolicy connectionRecoveryPolicy)
Sets the policy to use for the recovery of Connections after an unexpected Connection closure.
|
Config |
withConnectionRetryPolicy(RetryPolicy connectionRetryPolicy)
Sets the policy to use for handling
Connection invocation errors. |
Config |
withConnectRetryPolicy(RetryPolicy connectRetryPolicy)
Sets the policy to use for handling initial
connection attempt errors. |
Config |
withConsumerListeners(ConsumerListener... consumerListeners)
Sets the
consumerListeners to call on consumer related events. |
Config |
withConsumerRecovery(boolean enabled)
Sets whether consumer recovery is enabled or not.
|
Config |
withExchangeRecovery(boolean enabled)
Sets whether exchange and exchange binding recovery is enabled or not.
|
Config |
withQueueRecovery(boolean enabled)
Sets whether queue and queue binding recovery is enabled or not.
|
Config |
withRecoveryPolicy(RecoveryPolicy recoveryPolicy)
Sets the policy to use for the recovery of Connections/Channels/Consumers after an unexpected
Connection/Channel closure.
|
Config |
withRetryPolicy(RetryPolicy retryPolicy)
Sets the policy to use for handling
connection attempt , Connection invocation, and Channel invocation errors. |
public Config()
public Config(Config parent)
parent
.public static ConfigurableChannel of(com.rabbitmq.client.Channel channel)
channel
as a ConfigurableChannel
.IllegalArgumentException
- if channel
was not created by Lyrapublic static ConfigurableConnection of(com.rabbitmq.client.Connection connection)
connection
as a ConfigurableConnection
.IllegalArgumentException
- if connection
was not created by Lyrapublic Collection<ChannelListener> getChannelListeners()
ChannelConfig
getChannelListeners
in interface ChannelConfig
ChannelConfig.withChannelListeners(ChannelListener...)
public RecoveryPolicy getChannelRecoveryPolicy()
ChannelConfig
getChannelRecoveryPolicy
in interface ChannelConfig
ChannelConfig.withChannelRecoveryPolicy(RecoveryPolicy)
public RetryPolicy getChannelRetryPolicy()
ChannelConfig
getChannelRetryPolicy
in interface ChannelConfig
ChannelConfig.withChannelRetryPolicy(RetryPolicy)
public Collection<ConnectionListener> getConnectionListeners()
ConnectionConfig
getConnectionListeners
in interface ConnectionConfig
ConnectionConfig.withConnectionListeners(ConnectionListener...)
public RecoveryPolicy getConnectionRecoveryPolicy()
ConnectionConfig
getConnectionRecoveryPolicy
in interface ConnectionConfig
ConnectionConfig.withConnectionRecoveryPolicy(RecoveryPolicy)
public RetryPolicy getConnectionRetryPolicy()
ConnectionConfig
getConnectionRetryPolicy
in interface ConnectionConfig
ConnectionConfig.withConnectionRetryPolicy(RetryPolicy)
public RetryPolicy getConnectRetryPolicy()
connection attempt
errors. Overrides the global retry
policy
.public Collection<ConsumerListener> getConsumerListeners()
ConsumerConfig
getConsumerListeners
in interface ConsumerConfig
ConsumerConfig.getConsumerListeners()
public Set<Class<? extends Exception>> getRecoverableExceptions()
SocketTimeoutException
, ConnectException
, AlreadyClosedException
, and
TimeoutException
, but this set can be mutated directly to change the recoverable
exceptions.public Set<Class<? extends Exception>> getRetryableExceptions()
SocketTimeoutException
, ConnectException
, AlreadyClosedException
, and
TimeoutException
, but this set can be mutated directly to change the retryable
exceptions.public boolean isConsumerRecoveryEnabled()
ConsumerConfig
isConsumerRecoveryEnabled
in interface ConsumerConfig
ConsumerConfig.withConsumerRecovery(boolean)
public boolean isExchangeRecoveryEnabled()
ChannelConfig
Channel.exchangeDelete(String)
.
Defaults to true when channel recovery is configured.
isExchangeRecoveryEnabled
in interface ChannelConfig
ChannelConfig.withExchangeRecovery(boolean)
public boolean isQueueRecoveryEnabled()
ChannelConfig
Channel.queueDelete(String)
.
Defaults to true when channel recovery is configured.
isQueueRecoveryEnabled
in interface ChannelConfig
ChannelConfig.withQueueRecovery(boolean)
public Config withChannelListeners(ChannelListener... channelListeners)
ChannelConfig
channelListeners
to call on channel related events.withChannelListeners
in interface ChannelConfig
public Config withChannelRecoveryPolicy(RecoveryPolicy channelRecoveryPolicy)
ChannelConfig
recoveryPolicy
to use for recovering the channel.withChannelRecoveryPolicy
in interface ChannelConfig
public Config withChannelRetryPolicy(RetryPolicy channelRetryPolicy)
ChannelConfig
retryPolicy
to use for retrying failed invocations on the channel.withChannelRetryPolicy
in interface ChannelConfig
public Config withConnectionListeners(ConnectionListener... connectionListeners)
ConnectionConfig
connectionListeners
to call on connection related events.withConnectionListeners
in interface ConnectionConfig
public Config withConnectionRecoveryPolicy(RecoveryPolicy connectionRecoveryPolicy)
ConnectionConfig
withConnectionRecoveryPolicy
in interface ConnectionConfig
public Config withConnectionRetryPolicy(RetryPolicy connectionRetryPolicy)
ConnectionConfig
Connection
invocation errors.withConnectionRetryPolicy
in interface ConnectionConfig
public Config withConnectRetryPolicy(RetryPolicy connectRetryPolicy)
connection attempt
errors. Overrides the
global retry policy
.public Config withConsumerListeners(ConsumerListener... consumerListeners)
ConsumerConfig
consumerListeners
to call on consumer related events.withConsumerListeners
in interface ConsumerConfig
public Config withConsumerRecovery(boolean enabled)
ConsumerConfig
withConsumerRecovery
in interface ConsumerConfig
public Config withExchangeRecovery(boolean enabled)
ChannelConfig
Channel.exchangeDelete(String)
.withExchangeRecovery
in interface ChannelConfig
public Config withQueueRecovery(boolean enabled)
ChannelConfig
Channel.queueDelete(String)
.withQueueRecovery
in interface ChannelConfig
public Config withRecoveryPolicy(RecoveryPolicy recoveryPolicy)
withConnectionRecoveryPolicy(RecoveryPolicy)
and
withChannelRecoveryPolicy(RecoveryPolicy)
.public Config withRetryPolicy(RetryPolicy retryPolicy)
connection attempt
, Connection
invocation, and Channel
invocation errors. Can
be overridden with specific policies via withConnectRetryPolicy(RetryPolicy)
,
withConnectionRetryPolicy(RetryPolicy)
, and
withChannelRetryPolicy(RetryPolicy)
.Copyright © 2016. All rights reserved.