Class AutorecoveringChannel

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • recoveryListeners

        private final java.util.List<RecoveryListener> recoveryListeners
      • returnListeners

        private final java.util.List<ReturnListener> returnListeners
      • confirmListeners

        private final java.util.List<ConfirmListener> confirmListeners
      • consumerTags

        private final java.util.Set<java.lang.String> consumerTags
      • prefetchCountConsumer

        private int prefetchCountConsumer
      • prefetchCountGlobal

        private int prefetchCountGlobal
      • usesPublisherConfirms

        private boolean usesPublisherConfirms
      • usesTransactions

        private boolean usesTransactions
    • Method Detail

      • getChannelNumber

        public int getChannelNumber()
        Description copied from interface: Channel
        Retrieve this channel's channel number.
        Specified by:
        getChannelNumber in interface Channel
        Returns:
        the channel number
      • getDelegate

        public Channel getDelegate()
      • close

        public void close()
                   throws java.io.IOException,
                          java.util.concurrent.TimeoutException
        Description copied from interface: Channel
        Close this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Channel
        Throws:
        java.io.IOException - if an error is encountered
        java.util.concurrent.TimeoutException
      • close

        public void close​(int closeCode,
                          java.lang.String closeMessage)
                   throws java.io.IOException,
                          java.util.concurrent.TimeoutException
        Description copied from interface: Channel
        Close this channel.
        Specified by:
        close in interface Channel
        Parameters:
        closeCode - the close code (See under "Reply Codes" in the AMQP specification)
        closeMessage - a message indicating the reason for closing the connection
        Throws:
        java.io.IOException - if an error is encountered
        java.util.concurrent.TimeoutException
      • abort

        public void abort()
                   throws java.io.IOException
        Description copied from interface: Channel
        Abort this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'. Forces the channel to close and waits for the close operation to complete. Any encountered exceptions in the close operation are silently discarded.
        Specified by:
        abort in interface Channel
        Throws:
        java.io.IOException
      • abort

        public void abort​(int closeCode,
                          java.lang.String closeMessage)
                   throws java.io.IOException
        Description copied from interface: Channel
        Abort this channel. Forces the channel to close and waits for the close operation to complete. Any encountered exceptions in the close operation are silently discarded.
        Specified by:
        abort in interface Channel
        Throws:
        java.io.IOException
      • executeAndClean

        private void executeAndClean​(Utils.IoTimeoutExceptionRunnable callback)
                              throws java.io.IOException,
                                     java.util.concurrent.TimeoutException
        Throws:
        java.io.IOException
        java.util.concurrent.TimeoutException
      • removeReturnListener

        public boolean removeReturnListener​(ReturnListener listener)
        Description copied from interface: Channel
        Remove a ReturnListener.
        Specified by:
        removeReturnListener in interface Channel
        Parameters:
        listener - the listener to remove
        Returns:
        true if the listener was found and removed, false otherwise
      • removeConfirmListener

        public boolean removeConfirmListener​(ConfirmListener listener)
        Description copied from interface: Channel
        Remove a ConfirmListener.
        Specified by:
        removeConfirmListener in interface Channel
        Parameters:
        listener - the listener to remove
        Returns:
        true if the listener was found and removed, false otherwise
      • getDefaultConsumer

        public Consumer getDefaultConsumer()
        Description copied from interface: Channel
        Get the current default consumer. @see setDefaultConsumer for rationale.
        Specified by:
        getDefaultConsumer in interface Channel
        Returns:
        an interface to the current default consumer.
      • setDefaultConsumer

        public void setDefaultConsumer​(Consumer consumer)
        Description copied from interface: Channel
        Set the current default consumer. Under certain circumstances it is possible for a channel to receive a message delivery which does not match any consumer which is currently set up via basicConsume(). This will occur after the following sequence of events: ctag = basicConsume(queue, consumer); // i.e. with explicit acks // some deliveries take place but are not acked basicCancel(ctag); basicRecover(false); Since requeue is specified to be false in the basicRecover, the spec states that the message must be redelivered to "the original recipient" - i.e. the same channel / consumer-tag. But the consumer is no longer active. In these circumstances, you can register a default consumer to handle such deliveries. If no default consumer is registered an IllegalStateException will be thrown when such a delivery arrives. Most people will not need to use this.
        Specified by:
        setDefaultConsumer in interface Channel
        Parameters:
        consumer - the consumer to use, or null indicating "don't use one".
      • basicQos

        public void basicQos​(int prefetchSize,
                             int prefetchCount,
                             boolean global)
                      throws java.io.IOException
        Description copied from interface: Channel
        Request specific "quality of service" settings.

        These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.

        Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).

        Specified by:
        basicQos in interface Channel
        Parameters:
        prefetchSize - maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited
        prefetchCount - maximum number of messages that the server will deliver, 0 if unlimited
        global - true if the settings should be applied to the entire channel rather than each consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Qos
      • basicQos

        public void basicQos​(int prefetchCount)
                      throws java.io.IOException
        Description copied from interface: Channel
        Request a specific prefetchCount "quality of service" settings for this channel.

        Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).

        Specified by:
        basicQos in interface Channel
        Parameters:
        prefetchCount - maximum number of messages that the server will deliver, 0 if unlimited
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        Channel.basicQos(int, int, boolean)
      • basicQos

        public void basicQos​(int prefetchCount,
                             boolean global)
                      throws java.io.IOException
        Description copied from interface: Channel
        Request a specific prefetchCount "quality of service" settings for this channel.

        Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).

        Specified by:
        basicQos in interface Channel
        Parameters:
        prefetchCount - maximum number of messages that the server will deliver, 0 if unlimited
        global - true if the settings should be applied to the entire channel rather than each consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        Channel.basicQos(int, int, boolean)
      • basicPublish

        public void basicPublish​(java.lang.String exchange,
                                 java.lang.String routingKey,
                                 AMQP.BasicProperties props,
                                 byte[] body)
                          throws java.io.IOException
        Description copied from interface: Channel
        Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.
        Specified by:
        basicPublish in interface Channel
        Parameters:
        exchange - the exchange to publish the message to
        routingKey - the routing key
        props - other properties for the message - routing headers etc
        body - the message body
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Publish, Resource-driven alarms
      • basicPublish

        public void basicPublish​(java.lang.String exchange,
                                 java.lang.String routingKey,
                                 boolean mandatory,
                                 AMQP.BasicProperties props,
                                 byte[] body)
                          throws java.io.IOException
        Description copied from interface: Channel
        Publish a message. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.
        Specified by:
        basicPublish in interface Channel
        Parameters:
        exchange - the exchange to publish the message to
        routingKey - the routing key
        mandatory - true if the 'mandatory' flag is to be set
        props - other properties for the message - routing headers etc
        body - the message body
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Publish, Resource-driven alarms
      • basicPublish

        public void basicPublish​(java.lang.String exchange,
                                 java.lang.String routingKey,
                                 boolean mandatory,
                                 boolean immediate,
                                 AMQP.BasicProperties props,
                                 byte[] body)
                          throws java.io.IOException
        Description copied from interface: Channel
        Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.
        Specified by:
        basicPublish in interface Channel
        Parameters:
        exchange - the exchange to publish the message to
        routingKey - the routing key
        mandatory - true if the 'mandatory' flag is to be set
        immediate - true if the 'immediate' flag is to be set. Note that the RabbitMQ server does not support this flag.
        props - other properties for the message - routing headers etc
        body - the message body
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Publish, Resource-driven alarms
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       java.lang.String type)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Actively declare a non-autodelete, non-durable exchange with no extra arguments
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       BuiltinExchangeType type)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Actively declare a non-autodelete, non-durable exchange with no extra arguments
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       java.lang.String type,
                                                       boolean durable)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Actively declare a non-autodelete exchange with no extra arguments
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       BuiltinExchangeType type,
                                                       boolean durable)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Actively declare a non-autodelete exchange with no extra arguments
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       java.lang.String type,
                                                       boolean durable,
                                                       boolean autoDelete,
                                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Declare an exchange.
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        arguments - other properties (construction arguments) for the exchange
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       BuiltinExchangeType type,
                                                       boolean durable,
                                                       boolean autoDelete,
                                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Declare an exchange.
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        arguments - other properties (construction arguments) for the exchange
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       java.lang.String type,
                                                       boolean durable,
                                                       boolean autoDelete,
                                                       boolean internal,
                                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Declare an exchange, via an interface that allows the complete set of arguments.
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        internal - true if the exchange is internal, i.e. can't be directly published to by a client.
        arguments - other properties (construction arguments) for the exchange
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclare

        public AMQP.Exchange.DeclareOk exchangeDeclare​(java.lang.String exchange,
                                                       BuiltinExchangeType type,
                                                       boolean durable,
                                                       boolean autoDelete,
                                                       boolean internal,
                                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                                throws java.io.IOException
        Description copied from interface: Channel
        Declare an exchange, via an interface that allows the complete set of arguments.
        Specified by:
        exchangeDeclare in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        internal - true if the exchange is internal, i.e. can't be directly published to by a client.
        arguments - other properties (construction arguments) for the exchange
        Returns:
        a declaration-confirm method to indicate the exchange was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk
      • exchangeDeclareNoWait

        public void exchangeDeclareNoWait​(java.lang.String exchange,
                                          java.lang.String type,
                                          boolean durable,
                                          boolean autoDelete,
                                          boolean internal,
                                          java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                   throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.exchangeDeclare(String, String, boolean, boolean, java.util.Map) but sets nowait parameter to true and returns nothing (as there will be no response from the server).
        Specified by:
        exchangeDeclareNoWait in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        internal - true if the exchange is internal, i.e. can't be directly published to by a client.
        arguments - other properties (construction arguments) for the exchange
        Throws:
        java.io.IOException - if an error is encountered
      • exchangeDeclareNoWait

        public void exchangeDeclareNoWait​(java.lang.String exchange,
                                          BuiltinExchangeType type,
                                          boolean durable,
                                          boolean autoDelete,
                                          boolean internal,
                                          java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                   throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.exchangeDeclare(String, String, boolean, boolean, java.util.Map) but sets nowait parameter to true and returns nothing (as there will be no response from the server).
        Specified by:
        exchangeDeclareNoWait in interface Channel
        Parameters:
        exchange - the name of the exchange
        type - the exchange type
        durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
        autoDelete - true if the server should delete the exchange when it is no longer in use
        internal - true if the exchange is internal, i.e. can't be directly published to by a client.
        arguments - other properties (construction arguments) for the exchange
        Throws:
        java.io.IOException - if an error is encountered
      • exchangeDeclarePassive

        public AMQP.Exchange.DeclareOk exchangeDeclarePassive​(java.lang.String name)
                                                       throws java.io.IOException
        Description copied from interface: Channel
        Declare an exchange passively; that is, check if the named exchange exists.
        Specified by:
        exchangeDeclarePassive in interface Channel
        Parameters:
        name - check the existence of an exchange named this
        Throws:
        java.io.IOException - the server will raise a 404 channel exception if the named exchange does not exist.
      • exchangeDelete

        public AMQP.Exchange.DeleteOk exchangeDelete​(java.lang.String exchange,
                                                     boolean ifUnused)
                                              throws java.io.IOException
        Description copied from interface: Channel
        Delete an exchange
        Specified by:
        exchangeDelete in interface Channel
        Parameters:
        exchange - the name of the exchange
        ifUnused - true to indicate that the exchange is only to be deleted if it is unused
        Returns:
        a deletion-confirm method to indicate the exchange was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Delete, AMQP.Exchange.DeleteOk
      • exchangeDeleteNoWait

        public void exchangeDeleteNoWait​(java.lang.String exchange,
                                         boolean ifUnused)
                                  throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.exchangeDelete(String, boolean) but sets nowait parameter to true and returns void (as there will be no response from the server).
        Specified by:
        exchangeDeleteNoWait in interface Channel
        Parameters:
        exchange - the name of the exchange
        ifUnused - true to indicate that the exchange is only to be deleted if it is unused
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Delete, AMQP.Exchange.DeleteOk
      • exchangeDelete

        public AMQP.Exchange.DeleteOk exchangeDelete​(java.lang.String exchange)
                                              throws java.io.IOException
        Description copied from interface: Channel
        Delete an exchange, without regard for whether it is in use or not
        Specified by:
        exchangeDelete in interface Channel
        Parameters:
        exchange - the name of the exchange
        Returns:
        a deletion-confirm method to indicate the exchange was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Delete, AMQP.Exchange.DeleteOk
      • exchangeBind

        public AMQP.Exchange.BindOk exchangeBind​(java.lang.String destination,
                                                 java.lang.String source,
                                                 java.lang.String routingKey)
                                          throws java.io.IOException
        Description copied from interface: Channel
        Bind an exchange to an exchange, with no extra arguments.
        Specified by:
        exchangeBind in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Bind, AMQP.Exchange.BindOk
      • exchangeBind

        public AMQP.Exchange.BindOk exchangeBind​(java.lang.String destination,
                                                 java.lang.String source,
                                                 java.lang.String routingKey,
                                                 java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                          throws java.io.IOException
        Description copied from interface: Channel
        Bind an exchange to an exchange.
        Specified by:
        exchangeBind in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Bind, AMQP.Exchange.BindOk
      • exchangeBindNoWait

        public void exchangeBindNoWait​(java.lang.String destination,
                                       java.lang.String source,
                                       java.lang.String routingKey,
                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.exchangeBind(String, String, String, java.util.Map) but sets nowait parameter to true and returns void (as there will be no response from the server).
        Specified by:
        exchangeBindNoWait in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Throws:
        java.io.IOException - if an error is encountered
      • exchangeUnbind

        public AMQP.Exchange.UnbindOk exchangeUnbind​(java.lang.String destination,
                                                     java.lang.String source,
                                                     java.lang.String routingKey)
                                              throws java.io.IOException
        Description copied from interface: Channel
        Unbind an exchange from an exchange, with no extra arguments.
        Specified by:
        exchangeUnbind in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Bind, AMQP.Exchange.BindOk
      • exchangeUnbind

        public AMQP.Exchange.UnbindOk exchangeUnbind​(java.lang.String destination,
                                                     java.lang.String source,
                                                     java.lang.String routingKey,
                                                     java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                              throws java.io.IOException
        Description copied from interface: Channel
        Unbind an exchange from an exchange.
        Specified by:
        exchangeUnbind in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Exchange.Bind, AMQP.Exchange.BindOk
      • exchangeUnbindNoWait

        public void exchangeUnbindNoWait​(java.lang.String destination,
                                         java.lang.String source,
                                         java.lang.String routingKey,
                                         java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                  throws java.io.IOException
        Description copied from interface: Channel
        Same as Channel.exchangeUnbind(String, String, String, java.util.Map) but sets no-wait parameter to true and returns nothing (as there will be no response from the server).
        Specified by:
        exchangeUnbindNoWait in interface Channel
        Parameters:
        destination - the name of the exchange to which messages flow across the binding
        source - the name of the exchange from which messages flow across the binding
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Throws:
        java.io.IOException - if an error is encountered
      • queueDeclare

        public AMQP.Queue.DeclareOk queueDeclare()
                                          throws java.io.IOException
        Description copied from interface: Channel
        Actively declare a server-named exclusive, autodelete, non-durable queue. The name of the new queue is held in the "queue" field of the AMQP.Queue.DeclareOk result.
        Specified by:
        queueDeclare in interface Channel
        Returns:
        a declaration-confirm method to indicate the queue was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Declare, AMQP.Queue.DeclareOk
      • queueDeclare

        public AMQP.Queue.DeclareOk queueDeclare​(java.lang.String queue,
                                                 boolean durable,
                                                 boolean exclusive,
                                                 boolean autoDelete,
                                                 java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                          throws java.io.IOException
        Description copied from interface: Channel
        Declare a queue
        Specified by:
        queueDeclare in interface Channel
        Parameters:
        queue - the name of the queue
        durable - true if we are declaring a durable queue (the queue will survive a server restart)
        exclusive - true if we are declaring an exclusive queue (restricted to this connection)
        autoDelete - true if we are declaring an autodelete queue (server will delete it when no longer in use)
        arguments - other properties (construction arguments) for the queue
        Returns:
        a declaration-confirm method to indicate the queue was successfully declared
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Declare, AMQP.Queue.DeclareOk
      • queueDeclareNoWait

        public void queueDeclareNoWait​(java.lang.String queue,
                                       boolean durable,
                                       boolean exclusive,
                                       boolean autoDelete,
                                       java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.queueDeclare(String, boolean, boolean, boolean, java.util.Map) but sets nowait flag to true and returns no result (as there will be no response from the server).
        Specified by:
        queueDeclareNoWait in interface Channel
        Parameters:
        queue - the name of the queue
        durable - true if we are declaring a durable queue (the queue will survive a server restart)
        exclusive - true if we are declaring an exclusive queue (restricted to this connection)
        autoDelete - true if we are declaring an autodelete queue (server will delete it when no longer in use)
        arguments - other properties (construction arguments) for the queue
        Throws:
        java.io.IOException - if an error is encountered
      • queueDeclarePassive

        public AMQP.Queue.DeclareOk queueDeclarePassive​(java.lang.String queue)
                                                 throws java.io.IOException
        Description copied from interface: Channel
        Declare a queue passively; i.e., check if it exists. In AMQP 0-9-1, all arguments aside from nowait are ignored; and sending nowait makes this method a no-op, so we default it to false.
        Specified by:
        queueDeclarePassive in interface Channel
        Parameters:
        queue - the name of the queue
        Returns:
        a declaration-confirm method to indicate the queue exists
        Throws:
        java.io.IOException - if an error is encountered, including if the queue does not exist and if the queue is exclusively owned by another connection.
        See Also:
        AMQP.Queue.Declare, AMQP.Queue.DeclareOk
      • messageCount

        public long messageCount​(java.lang.String queue)
                          throws java.io.IOException
        Description copied from interface: Channel
        Returns the number of messages in a queue ready to be delivered to consumers. This method assumes the queue exists. If it doesn't, the channels will be closed with an exception.
        Specified by:
        messageCount in interface Channel
        Parameters:
        queue - the name of the queue
        Returns:
        the number of messages in ready state
        Throws:
        java.io.IOException - Problem transmitting method.
      • consumerCount

        public long consumerCount​(java.lang.String queue)
                           throws java.io.IOException
        Description copied from interface: Channel
        Returns the number of consumers on a queue. This method assumes the queue exists. If it doesn't, the channel will be closed with an exception.
        Specified by:
        consumerCount in interface Channel
        Parameters:
        queue - the name of the queue
        Returns:
        the number of consumers
        Throws:
        java.io.IOException - Problem transmitting method.
      • queueDelete

        public AMQP.Queue.DeleteOk queueDelete​(java.lang.String queue)
                                        throws java.io.IOException
        Description copied from interface: Channel
        Delete a queue, without regard for whether it is in use or has messages on it
        Specified by:
        queueDelete in interface Channel
        Parameters:
        queue - the name of the queue
        Returns:
        a deletion-confirm method to indicate the queue was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Delete, AMQP.Queue.DeleteOk
      • queueDelete

        public AMQP.Queue.DeleteOk queueDelete​(java.lang.String queue,
                                               boolean ifUnused,
                                               boolean ifEmpty)
                                        throws java.io.IOException
        Description copied from interface: Channel
        Delete a queue
        Specified by:
        queueDelete in interface Channel
        Parameters:
        queue - the name of the queue
        ifUnused - true if the queue should be deleted only if not in use
        ifEmpty - true if the queue should be deleted only if empty
        Returns:
        a deletion-confirm method to indicate the queue was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Delete, AMQP.Queue.DeleteOk
      • queueDeleteNoWait

        public void queueDeleteNoWait​(java.lang.String queue,
                                      boolean ifUnused,
                                      boolean ifEmpty)
                               throws java.io.IOException
        Description copied from interface: Channel
        Like Channel.queueDelete(String, boolean, boolean) but sets nowait parameter to true and returns nothing (as there will be no response from the server).
        Specified by:
        queueDeleteNoWait in interface Channel
        Parameters:
        queue - the name of the queue
        ifUnused - true if the queue should be deleted only if not in use
        ifEmpty - true if the queue should be deleted only if empty
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Delete, AMQP.Queue.DeleteOk
      • queueBind

        public AMQP.Queue.BindOk queueBind​(java.lang.String queue,
                                           java.lang.String exchange,
                                           java.lang.String routingKey)
                                    throws java.io.IOException
        Description copied from interface: Channel
        Bind a queue to an exchange, with no extra arguments.
        Specified by:
        queueBind in interface Channel
        Parameters:
        queue - the name of the queue
        exchange - the name of the exchange
        routingKey - the routing key to use for the binding
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Bind, AMQP.Queue.BindOk
      • queueBind

        public AMQP.Queue.BindOk queueBind​(java.lang.String queue,
                                           java.lang.String exchange,
                                           java.lang.String routingKey,
                                           java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                    throws java.io.IOException
        Description copied from interface: Channel
        Bind a queue to an exchange.
        Specified by:
        queueBind in interface Channel
        Parameters:
        queue - the name of the queue
        exchange - the name of the exchange
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Returns:
        a binding-confirm method if the binding was successfully created
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Bind, AMQP.Queue.BindOk
      • queueBindNoWait

        public void queueBindNoWait​(java.lang.String queue,
                                    java.lang.String exchange,
                                    java.lang.String routingKey,
                                    java.util.Map<java.lang.String,​java.lang.Object> arguments)
                             throws java.io.IOException
        Description copied from interface: Channel
        Same as Channel.queueBind(String, String, String, java.util.Map) but sets nowait parameter to true and returns void (as there will be no response from the server).
        Specified by:
        queueBindNoWait in interface Channel
        Parameters:
        queue - the name of the queue
        exchange - the name of the exchange
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Throws:
        java.io.IOException - if an error is encountered
      • queueUnbind

        public AMQP.Queue.UnbindOk queueUnbind​(java.lang.String queue,
                                               java.lang.String exchange,
                                               java.lang.String routingKey)
                                        throws java.io.IOException
        Description copied from interface: Channel
        Unbinds a queue from an exchange, with no extra arguments.
        Specified by:
        queueUnbind in interface Channel
        Parameters:
        queue - the name of the queue
        exchange - the name of the exchange
        routingKey - the routing key to use for the binding
        Returns:
        an unbinding-confirm method if the binding was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Unbind, AMQP.Queue.UnbindOk
      • queueUnbind

        public AMQP.Queue.UnbindOk queueUnbind​(java.lang.String queue,
                                               java.lang.String exchange,
                                               java.lang.String routingKey,
                                               java.util.Map<java.lang.String,​java.lang.Object> arguments)
                                        throws java.io.IOException
        Description copied from interface: Channel
        Unbind a queue from an exchange.
        Specified by:
        queueUnbind in interface Channel
        Parameters:
        queue - the name of the queue
        exchange - the name of the exchange
        routingKey - the routing key to use for the binding
        arguments - other properties (binding parameters)
        Returns:
        an unbinding-confirm method if the binding was successfully deleted
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Unbind, AMQP.Queue.UnbindOk
      • queuePurge

        public AMQP.Queue.PurgeOk queuePurge​(java.lang.String queue)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Purges the contents of the given queue.
        Specified by:
        queuePurge in interface Channel
        Parameters:
        queue - the name of the queue
        Returns:
        a purge-confirm method if the purge was executed successfully
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Queue.Purge, AMQP.Queue.PurgeOk
      • basicGet

        public GetResponse basicGet​(java.lang.String queue,
                                    boolean autoAck)
                             throws java.io.IOException
        Description copied from interface: Channel
        Retrieve a message from a queue using AMQP.Basic.Get
        Specified by:
        basicGet in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        Returns:
        a GetResponse containing the retrieved message data
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Get, AMQP.Basic.GetOk, AMQP.Basic.GetEmpty
      • basicAck

        public void basicAck​(long deliveryTag,
                             boolean multiple)
                      throws java.io.IOException
        Description copied from interface: Channel
        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
        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 interface: Channel
        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
        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 interface: Channel
        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
        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
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             Consumer callback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        callback - an interface to the consumer object
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access only to basic.deliver and basic.cancel AMQP methods (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             DeliverCallback deliverCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access only to basic.deliver and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        deliverCallback - callback when a message is delivered
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access to basic.deliver, basic.cancel and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             Consumer callback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        callback - an interface to the consumer object
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer. Provide access only to basic.deliver and basic.cancel AMQP methods (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             DeliverCallback deliverCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer. Provide access only to basic.deliver and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        deliverCallback - callback when a message is delivered
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer. Provide access to basic.deliver, basic.cancel and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             Consumer callback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        arguments - a set of arguments for the consume
        callback - an interface to the consumer object
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access only to basic.deliver and basic.cancel AMQP methods (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access only to basic.deliver and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access to basic.deliver, basic.cancel and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag generated by the server
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             boolean noLocal,
                                             boolean exclusive,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             Consumer callback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a consumer. Calls the consumer's Consumer.handleConsumeOk(java.lang.String) method.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        noLocal - True if the server should not deliver to this consumer messages published on this channel's connection. Note that the RabbitMQ server does not support this flag.
        exclusive - true if this is an exclusive consumer
        arguments - a set of arguments for the consume
        callback - an interface to the consumer object
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             boolean noLocal,
                                             boolean exclusive,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a consumer. Calls the consumer's Consumer.handleConsumeOk(java.lang.String) method. Provide access only to basic.deliver and basic.cancel AMQP methods (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        noLocal - True if the server should not deliver to this consumer messages published on this channel's connection. Note that the RabbitMQ server does not support this flag.
        exclusive - true if this is an exclusive consumer
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             boolean noLocal,
                                             boolean exclusive,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a consumer. Calls the consumer's Consumer.handleConsumeOk(java.lang.String) method. Provide access only to basic.deliver and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        noLocal - True if the server should not deliver to this consumer messages published on this channel's connection. Note that the RabbitMQ server does not support this flag.
        exclusive - true if this is an exclusive consumer
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk
      • basicConsume

        public java.lang.String basicConsume​(java.lang.String queue,
                                             boolean autoAck,
                                             java.lang.String consumerTag,
                                             boolean noLocal,
                                             boolean exclusive,
                                             java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                             DeliverCallback deliverCallback,
                                             CancelCallback cancelCallback,
                                             ConsumerShutdownSignalCallback shutdownSignalCallback)
                                      throws java.io.IOException
        Description copied from interface: Channel
        Start a consumer. Calls the consumer's Consumer.handleConsumeOk(java.lang.String) method. Provide access to basic.deliver, basic.cancel and shutdown signal callbacks (which is sufficient for most cases). See methods with a Consumer argument to have access to all the application callbacks.
        Specified by:
        basicConsume in interface Channel
        Parameters:
        queue - the name of the queue
        autoAck - true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements
        consumerTag - a client-generated consumer tag to establish context
        noLocal - True if the server should not deliver to this consumer messages published on this channel's connection. Note that the RabbitMQ server does not support this flag.
        exclusive - true if this is an exclusive consumer
        arguments - a set of arguments for the consume
        deliverCallback - callback when a message is delivered
        cancelCallback - callback when the consumer is cancelled
        shutdownSignalCallback - callback when the channel/connection is shut down
        Returns:
        the consumerTag associated with the new consumer
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Basic.Consume, AMQP.Basic.ConsumeOk
      • basicCancel

        public void basicCancel​(java.lang.String consumerTag)
                         throws java.io.IOException
        Description copied from interface: Channel
        Cancel a consumer. Calls the consumer's Consumer.handleCancelOk(java.lang.String) method.
        Specified by:
        basicCancel in interface Channel
        Parameters:
        consumerTag - a client- or server-generated consumer tag to establish context
        Throws:
        java.io.IOException - if an error is encountered, or if the consumerTag is unknown
        See Also:
        AMQP.Basic.Cancel, AMQP.Basic.CancelOk
      • basicRecover

        public AMQP.Basic.RecoverOk basicRecover()
                                          throws java.io.IOException
        Description copied from interface: Channel

        Ask the broker to resend unacknowledged messages. In 0-8 basic.recover is asynchronous; in 0-9-1 it is synchronous, and the new, deprecated method basic.recover_async is asynchronous.

        Equivalent to calling basicRecover(true), messages will be requeued and possibly delivered to a different consumer.
        Specified by:
        basicRecover in interface Channel
        Throws:
        java.io.IOException
        See Also:
        Channel.basicRecover(boolean)
      • basicRecover

        public AMQP.Basic.RecoverOk basicRecover​(boolean requeue)
                                          throws java.io.IOException
        Description copied from interface: Channel
        Ask the broker to resend unacknowledged messages. In 0-8 basic.recover is asynchronous; in 0-9-1 it is synchronous, and the new, deprecated method basic.recover_async is asynchronous.
        Specified by:
        basicRecover in interface Channel
        Parameters:
        requeue - If true, messages will be requeued and possibly delivered to a different consumer. If false, messages will be redelivered to the same consumer.
        Throws:
        java.io.IOException
      • txSelect

        public AMQP.Tx.SelectOk txSelect()
                                  throws java.io.IOException
        Description copied from interface: Channel
        Enables TX mode on this channel.
        Specified by:
        txSelect in interface Channel
        Returns:
        a transaction-selection method to indicate the transaction was successfully initiated
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Tx.Select, AMQP.Tx.SelectOk
      • txCommit

        public AMQP.Tx.CommitOk txCommit()
                                  throws java.io.IOException
        Description copied from interface: Channel
        Commits a TX transaction on this channel.
        Specified by:
        txCommit in interface Channel
        Returns:
        a transaction-commit method to indicate the transaction was successfully committed
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Tx.Commit, AMQP.Tx.CommitOk
      • txRollback

        public AMQP.Tx.RollbackOk txRollback()
                                      throws java.io.IOException
        Description copied from interface: Channel
        Rolls back a TX transaction on this channel.
        Specified by:
        txRollback in interface Channel
        Returns:
        a transaction-rollback method to indicate the transaction was successfully rolled back
        Throws:
        java.io.IOException - if an error is encountered
        See Also:
        AMQP.Tx.Rollback, AMQP.Tx.RollbackOk
      • getNextPublishSeqNo

        public long getNextPublishSeqNo()
        Description copied from interface: Channel
        When in confirm mode, returns the sequence number of the next message to be published.
        Specified by:
        getNextPublishSeqNo in interface Channel
        Returns:
        the sequence number of the next message to be published
      • waitForConfirms

        public boolean waitForConfirms()
                                throws java.lang.InterruptedException
        Description copied from interface: Channel
        Wait until all messages published since the last call have been either ack'd or nack'd by the broker. Note, when called on a non-Confirm channel, waitForConfirms throws an IllegalStateException.
        Specified by:
        waitForConfirms in interface Channel
        Returns:
        whether all the messages were ack'd (and none were nack'd)
        Throws:
        java.lang.InterruptedException
      • waitForConfirms

        public boolean waitForConfirms​(long timeout)
                                throws java.lang.InterruptedException,
                                       java.util.concurrent.TimeoutException
        Description copied from interface: Channel
        Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown. When called on a non-Confirm channel, waitForConfirms throws an IllegalStateException.
        Specified by:
        waitForConfirms in interface Channel
        Returns:
        whether all the messages were ack'd (and none were nack'd)
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.TimeoutException
      • waitForConfirmsOrDie

        public void waitForConfirmsOrDie()
                                  throws java.io.IOException,
                                         java.lang.InterruptedException
        Description copied from interface: Channel
        Wait until all messages published since the last call have been either ack'd or nack'd by the broker. If any of the messages were nack'd, waitForConfirmsOrDie will throw an IOException. When called on a non-Confirm channel, it will throw an IllegalStateException.
        Specified by:
        waitForConfirmsOrDie in interface Channel
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • waitForConfirmsOrDie

        public void waitForConfirmsOrDie​(long timeout)
                                  throws java.io.IOException,
                                         java.lang.InterruptedException,
                                         java.util.concurrent.TimeoutException
        Description copied from interface: Channel
        Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown. If any of the messages were nack'd, waitForConfirmsOrDie will throw an IOException. When called on a non-Confirm channel, it will throw an IllegalStateException.
        Specified by:
        waitForConfirmsOrDie in interface Channel
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        java.util.concurrent.TimeoutException
      • asyncRpc

        public void asyncRpc​(Method method)
                      throws java.io.IOException
        Description copied from interface: Channel
        Asynchronously send a method over this channel.
        Specified by:
        asyncRpc in interface Channel
        Parameters:
        method - method to transmit over this channel.
        Throws:
        java.io.IOException - Problem transmitting method.
      • rpc

        public Command rpc​(Method method)
                    throws java.io.IOException
        Description copied from interface: Channel
        Synchronously send a method over this channel.
        Specified by:
        rpc in interface Channel
        Parameters:
        method - method to transmit over this channel.
        Returns:
        command response to method. Caller should cast as appropriate.
        Throws:
        java.io.IOException - Problem transmitting method.
      • isOpen

        public boolean isOpen()
        Description copied from interface: ShutdownNotifier
        Determine whether the component is currently open. Will return false if we are currently closing. Checking this method should be only for information, because of the race conditions - state can change after the call. Instead just execute and try to catch ShutdownSignalException and IOException
        Specified by:
        isOpen in interface ShutdownNotifier
        Returns:
        true when component is open, false otherwise
      • automaticallyRecover

        public void automaticallyRecover​(AutorecoveringConnection connection,
                                         Connection connDelegate)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • recoverShutdownListeners

        private void recoverShutdownListeners()
      • recoverReturnListeners

        private void recoverReturnListeners()
      • recoverConfirmListeners

        private void recoverConfirmListeners()
      • recoverState

        private void recoverState()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • notifyRecoveryListenersComplete

        private void notifyRecoveryListenersComplete()
      • notifyRecoveryListenersStarted

        private void notifyRecoveryListenersStarted()
      • recordQueueBinding

        private void recordQueueBinding​(java.lang.String queue,
                                        java.lang.String exchange,
                                        java.lang.String routingKey,
                                        java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • deleteRecordedQueueBinding

        private boolean deleteRecordedQueueBinding​(java.lang.String queue,
                                                   java.lang.String exchange,
                                                   java.lang.String routingKey,
                                                   java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • recordExchangeBinding

        private void recordExchangeBinding​(java.lang.String destination,
                                           java.lang.String source,
                                           java.lang.String routingKey,
                                           java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • deleteRecordedExchangeBinding

        private boolean deleteRecordedExchangeBinding​(java.lang.String destination,
                                                      java.lang.String source,
                                                      java.lang.String routingKey,
                                                      java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • recordQueue

        private void recordQueue​(AMQP.Queue.DeclareOk ok,
                                 java.lang.String queue,
                                 boolean durable,
                                 boolean exclusive,
                                 boolean autoDelete,
                                 java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • recordQueue

        private void recordQueue​(java.lang.String queue,
                                 RecordedQueue meta)
      • deleteRecordedQueue

        private void deleteRecordedQueue​(java.lang.String queue)
      • recordExchange

        private void recordExchange​(AMQP.Exchange.DeclareOk ok,
                                    java.lang.String exchange,
                                    java.lang.String type,
                                    boolean durable,
                                    boolean autoDelete,
                                    java.util.Map<java.lang.String,​java.lang.Object> arguments)
      • recordExchange

        private void recordExchange​(java.lang.String exchange,
                                    RecordedExchange x)
      • deleteRecordedExchange

        private void deleteRecordedExchange​(java.lang.String exchange)
      • recordConsumer

        private void recordConsumer​(java.lang.String result,
                                    java.lang.String queue,
                                    boolean autoAck,
                                    boolean exclusive,
                                    java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                    Consumer callback)
      • deleteRecordedConsumer

        public void deleteRecordedConsumer​(java.lang.String consumerTag)
        Delete the recorded consumer from this channel and accompanying connection
        Parameters:
        consumerTag - consumer tag to delete
      • maybeDeleteRecordedAutoDeleteExchange

        private void maybeDeleteRecordedAutoDeleteExchange​(java.lang.String exchange)
      • updateConsumerTag

        void updateConsumerTag​(java.lang.String tag,
                               java.lang.String newTag)
      • asyncCompletableRpc

        public java.util.concurrent.CompletableFuture<Command> asyncCompletableRpc​(Method method)
                                                                            throws java.io.IOException
        Description copied from interface: Channel
        Asynchronously send a method over this channel.
        Specified by:
        asyncCompletableRpc in interface Channel
        Parameters:
        method - method to transmit over this channel.
        Returns:
        a completable future that completes when the result is received
        Throws:
        java.io.IOException - Problem transmitting method.
      • recordOnRpcRequest

        private void recordOnRpcRequest​(Method method)
      • recordOnRpcResponse

        private void recordOnRpcResponse​(Method response,
                                         Method request)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object