Class RecoveryAwareChannelN
- java.lang.Object
-
- com.rabbitmq.client.impl.ShutdownNotifierComponent
-
- com.rabbitmq.client.impl.AMQChannel
-
- com.rabbitmq.client.impl.ChannelN
-
- com.rabbitmq.client.impl.recovery.RecoveryAwareChannelN
-
- All Implemented Interfaces:
Channel
,ShutdownNotifier
public class RecoveryAwareChannelN extends ChannelN
ChannelN
modification that keeps track of delivery tags and avoids sendingbasic.ack
,basic.nack
, andbasic.reject
for stale tags.- Since:
- 3.3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.rabbitmq.client.impl.AMQChannel
AMQChannel.BlockingRpcContinuation<T>, AMQChannel.RpcContinuation, AMQChannel.SimpleBlockingRpcContinuation
-
-
Field Summary
-
Fields inherited from class com.rabbitmq.client.impl.ChannelN
metricsCollector
-
Fields inherited from class com.rabbitmq.client.impl.AMQChannel
_blockContent, _channelMutex, _rpcTimeout, NO_RPC_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description RecoveryAwareChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService)
Construct a new channel on the given connection with the given channel number.RecoveryAwareChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService, MetricsCollector metricsCollector)
Construct a new channel on the given connection with the given channel number.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
basicAck(long deliveryTag, boolean multiple)
Public API - Public API - Acknowledge one or several received messages.void
basicNack(long deliveryTag, boolean multiple, boolean requeue)
Public API - Public API - Reject one or several received messages.void
basicReject(long deliveryTag, boolean requeue)
Public API - Public API - Reject a message.long
getActiveDeliveryTagOffset()
long
getMaxSeenDeliveryTag()
protected void
processDelivery(Command command, AMQImpl.Basic.Deliver method)
-
Methods inherited from class com.rabbitmq.client.impl.ChannelN
abort, abort, addConfirmListener, addFlowListener, addReturnListener, asyncRpc, basicCancel, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicGet, basicPublish, basicPublish, basicPublish, basicQos, basicQos, basicQos, basicRecover, basicRecover, clearConfirmListeners, clearFlowListeners, clearReturnListeners, close, close, close, confirmSelect, consumerCount, enqueueRpc, exchangeBind, exchangeBind, exchangeBindNoWait, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclareNoWait, exchangeDeclareNoWait, exchangeDeclarePassive, exchangeDelete, exchangeDelete, exchangeDeleteNoWait, exchangeUnbind, exchangeUnbind, exchangeUnbindNoWait, flowBlocked, getDefaultConsumer, getNextPublishSeqNo, markRpcFinished, messageCount, open, processAsync, processShutdownSignal, queueBind, queueBind, queueBindNoWait, queueDeclare, queueDeclare, queueDeclareNoWait, queueDeclarePassive, queueDelete, queueDelete, queueDeleteNoWait, queuePurge, queueUnbind, queueUnbind, removeConfirmListener, removeFlowListener, removeReturnListener, rpc, setDefaultConsumer, txCommit, txRollback, txSelect, waitForConfirms, waitForConfirms, waitForConfirmsOrDie, waitForConfirmsOrDie
-
Methods inherited from class com.rabbitmq.client.impl.AMQChannel
ensureIsOpen, exnWrappingRpc, getChannelNumber, getConnection, handleCompleteInboundCommand, handleFrame, isOutstandingRpc, nextOutstandingRpc, notifyOutstandingRpc, quiescingRpc, quiescingTransmit, quiescingTransmit, rpc, rpc, toString, transmit, transmit, wrap, wrap, wrapTimeoutException
-
Methods inherited from class com.rabbitmq.client.impl.ShutdownNotifierComponent
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener, setShutdownCauseIfOpen
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.rabbitmq.client.Channel
getChannelNumber, getConnection
-
Methods inherited from interface com.rabbitmq.client.ShutdownNotifier
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
-
-
-
-
Constructor Detail
-
RecoveryAwareChannelN
public RecoveryAwareChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService)
Construct a new channel on the given connection with the given channel number. Usually not called directly - call Connection.createChannel instead.- Parameters:
connection
- The connection associated with this channelchannelNumber
- The channel number to be associated with this channelworkService
- service for managing this channel's consumer callbacks
-
RecoveryAwareChannelN
public RecoveryAwareChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService, MetricsCollector metricsCollector)
Construct a new channel on the given connection with the given channel number. Usually not called directly - call Connection.createChannel instead.- Parameters:
connection
- The connection associated with this channelchannelNumber
- The channel number to be associated with this channelworkService
- service for managing this channel's consumer callbacksmetricsCollector
- service for managing metrics
-
-
Method Detail
-
processDelivery
protected void processDelivery(Command command, AMQImpl.Basic.Deliver method)
- Overrides:
processDelivery
in classChannelN
-
basicAck
public void basicAck(long deliveryTag, boolean multiple) throws IOException
Description copied from class:ChannelN
Public API - Acknowledge one or several received messages. Supply the deliveryTag from theAMQP.Basic.GetOk
orAMQP.Basic.Deliver
method containing the received message being acknowledged.- Specified by:
basicAck
in interfaceChannel
- Overrides:
basicAck
in classChannelN
- Parameters:
deliveryTag
- the tag from the receivedAMQP.Basic.GetOk
orAMQP.Basic.Deliver
multiple
- true to acknowledge all messages up to and including the supplied delivery tag; false to acknowledge just the supplied delivery tag.- Throws:
IOException
- if an error is encountered- See Also:
AMQP.Basic.Ack
-
basicNack
public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throws IOException
Description copied from class:ChannelN
Public API - Reject one or several received messages. Supply thedeliveryTag
from theAMQP.Basic.GetOk
orAMQP.Basic.GetOk
method containing the message to be rejected.- Specified by:
basicNack
in interfaceChannel
- Overrides:
basicNack
in classChannelN
- Parameters:
deliveryTag
- the tag from the receivedAMQP.Basic.GetOk
orAMQP.Basic.Deliver
multiple
- true to reject all messages up to and including the supplied delivery tag; false to reject just the supplied delivery tag.requeue
- true if the rejected message(s) should be requeued rather than discarded/dead-lettered- Throws:
IOException
- if an error is encountered- See Also:
AMQP.Basic.Nack
-
basicReject
public void basicReject(long deliveryTag, boolean requeue) throws IOException
Description copied from class:ChannelN
Public API - Reject a message. Supply the deliveryTag from theAMQP.Basic.GetOk
orAMQP.Basic.Deliver
method containing the received message being rejected.- Specified by:
basicReject
in interfaceChannel
- Overrides:
basicReject
in classChannelN
- Parameters:
deliveryTag
- the tag from the receivedAMQP.Basic.GetOk
orAMQP.Basic.Deliver
requeue
- true if the rejected message should be requeued rather than discarded/dead-lettered- Throws:
IOException
- if an error is encountered- See Also:
AMQP.Basic.Reject
-
getMaxSeenDeliveryTag
public long getMaxSeenDeliveryTag()
-
getActiveDeliveryTagOffset
public long getActiveDeliveryTagOffset()
-
-