Class RecoveryAwareChannelN

  • All Implemented Interfaces:
    Channel, ShutdownNotifier, java.lang.AutoCloseable

    public class RecoveryAwareChannelN
    extends ChannelN
    ChannelN modification that keeps track of delivery tags and avoids sending
    basic.ack
    ,
    basic.nack
    , and
    basic.reject
    for stale tags.
    Since:
    3.3.0
    • Field Detail

      • maxSeenDeliveryTag

        private volatile long maxSeenDeliveryTag
      • activeDeliveryTagOffset

        private volatile long activeDeliveryTagOffset
    • 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 channel
        channelNumber - The channel number to be associated with this channel
        workService - service for managing this channel's consumer callbacks
      • RecoveryAwareChannelN

        public RecoveryAwareChannelN​(AMQConnection connection,
                                     int channelNumber,
                                     ConsumerWorkService workService,
                                     MetricsCollector metricsCollector,
                                     ObservationCollector observationCollector)
        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 channel
        channelNumber - The channel number to be associated with this channel
        workService - service for managing this channel's consumer callbacks
        metricsCollector - service for managing metrics
    • Method Detail

      • basicAck

        public void basicAck​(long deliveryTag,
                             boolean multiple)
                      throws java.io.IOException
        Description copied from class: ChannelN
        Public API - Acknowledge one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being acknowledged.
        Specified by:
        basicAck in interface Channel
        Overrides:
        basicAck in class ChannelN
        Parameters:
        deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.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:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Ack
      • basicNack

        public void basicNack​(long deliveryTag,
                              boolean multiple,
                              boolean requeue)
                       throws java.io.IOException
        Description copied from class: ChannelN
        Public API - Reject one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the message to be rejected.
        Specified by:
        basicNack in interface Channel
        Overrides:
        basicNack in class ChannelN
        Parameters:
        deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.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:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Nack
      • basicReject

        public void basicReject​(long deliveryTag,
                                boolean requeue)
                         throws java.io.IOException
        Description copied from class: ChannelN
        Public API - Reject a message. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being rejected.
        Specified by:
        basicReject in interface Channel
        Overrides:
        basicReject in class ChannelN
        Parameters:
        deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.Basic.Deliver
        requeue - true if the rejected message should be requeued rather than discarded/dead-lettered
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Reject
      • getMaxSeenDeliveryTag

        public long getMaxSeenDeliveryTag()
      • getActiveDeliveryTagOffset

        public long getActiveDeliveryTagOffset()