Interface PublisherCallbackChannel

  • All Superinterfaces:
    java.lang.AutoCloseable, com.rabbitmq.client.Channel, com.rabbitmq.client.ShutdownNotifier
    All Known Implementing Classes:
    PublisherCallbackChannelImpl

    public interface PublisherCallbackChannel
    extends com.rabbitmq.client.Channel
    Instances of this interface support a single listener being registered for publisher confirms with multiple channels, by adding context to the callbacks.
    Since:
    1.0.1
    Author:
    Gary Russell
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  PublisherCallbackChannel.Listener
      Listeners implementing this interface can participate in publisher confirms received from multiple channels, by invoking addListener on each channel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String RETURN_LISTENER_CORRELATION_KEY
      Header used to determine which listener to invoke for a returned message.
      static java.lang.String RETURNED_MESSAGE_CORRELATION_KEY
      Header used to locate a pending confirm to which to attach a returned message.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addListener​(PublisherCallbackChannel.Listener listener)
      void addPendingConfirm​(PublisherCallbackChannel.Listener listener, long seq, PendingConfirm pendingConfirm)
      Adds a pending confirmation to this channel's map.
      java.util.Collection<PendingConfirm> expire​(PublisherCallbackChannel.Listener listener, long cutoffTime)
      Expire (remove) any PendingConfirms created before cutoffTime for the supplied listener and return them to the caller.
      com.rabbitmq.client.Channel getDelegate()
      Use this to invoke methods on the underlying rabbit client Channel that are not supported by this implementation.
      int getPendingConfirmsCount()
      Get the total pending confirms count.
      int getPendingConfirmsCount​(PublisherCallbackChannel.Listener listener)
      Get the PendingConfirms count.
      void setAfterAckCallback​(java.util.function.Consumer<com.rabbitmq.client.Channel> callback)
      Set a callback to be invoked after the ack/nack has been handled.
      • Methods inherited from interface com.rabbitmq.client.Channel

        abort, abort, addConfirmListener, addConfirmListener, addReturnListener, addReturnListener, asyncCompletableRpc, asyncRpc, basicAck, basicCancel, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicConsume, basicGet, basicNack, basicPublish, basicPublish, basicPublish, basicQos, basicQos, basicQos, basicRecover, basicRecover, basicReject, clearConfirmListeners, clearReturnListeners, close, close, confirmSelect, consumerCount, exchangeBind, exchangeBind, exchangeBindNoWait, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclare, exchangeDeclareNoWait, exchangeDeclareNoWait, exchangeDeclarePassive, exchangeDelete, exchangeDelete, exchangeDeleteNoWait, exchangeUnbind, exchangeUnbind, exchangeUnbindNoWait, getChannelNumber, getConnection, getDefaultConsumer, getNextPublishSeqNo, messageCount, queueBind, queueBind, queueBindNoWait, queueDeclare, queueDeclare, queueDeclareNoWait, queueDeclarePassive, queueDelete, queueDelete, queueDeleteNoWait, queuePurge, queueUnbind, queueUnbind, removeConfirmListener, removeReturnListener, rpc, setDefaultConsumer, txCommit, txRollback, txSelect, waitForConfirms, waitForConfirms, waitForConfirmsOrDie, waitForConfirmsOrDie
      • Methods inherited from interface com.rabbitmq.client.ShutdownNotifier

        addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
    • Field Detail

      • RETURN_LISTENER_CORRELATION_KEY

        static final java.lang.String RETURN_LISTENER_CORRELATION_KEY
        Header used to determine which listener to invoke for a returned message.
        See Also:
        Constant Field Values
      • RETURNED_MESSAGE_CORRELATION_KEY

        static final java.lang.String RETURNED_MESSAGE_CORRELATION_KEY
        Header used to locate a pending confirm to which to attach a returned message.
        See Also:
        Constant Field Values
    • Method Detail

      • expire

        java.util.Collection<PendingConfirm> expire​(PublisherCallbackChannel.Listener listener,
                                                    long cutoffTime)
        Expire (remove) any PendingConfirms created before cutoffTime for the supplied listener and return them to the caller.
        Parameters:
        listener - the listener.
        cutoffTime - the time before which expired messages were created.
        Returns:
        the list of expired confirms.
      • getPendingConfirmsCount

        int getPendingConfirmsCount()
        Get the total pending confirms count.
        Returns:
        the count.
        Since:
        2.1
      • addPendingConfirm

        void addPendingConfirm​(PublisherCallbackChannel.Listener listener,
                               long seq,
                               PendingConfirm pendingConfirm)
        Adds a pending confirmation to this channel's map.
        Parameters:
        listener - The listener.
        seq - The key to the map.
        pendingConfirm - The PendingConfirm object.
      • getDelegate

        com.rabbitmq.client.Channel getDelegate()
        Use this to invoke methods on the underlying rabbit client Channel that are not supported by this implementation.
        Returns:
        The underlying rabbit client Channel.
        Since:
        1.4.
      • setAfterAckCallback

        void setAfterAckCallback​(java.util.function.Consumer<com.rabbitmq.client.Channel> callback)
        Set a callback to be invoked after the ack/nack has been handled.
        Parameters:
        callback - the callback.
        Since:
        2.1