public interface

Channel

implements ShutdownNotifier
com.rabbitmq.client.Channel
Known Indirect Subclasses

Class Overview

Public API: Interface to an AMQ channel. See the spec for details.

To open a channel,

 Connection conn = ...;
 Channel channel = conn.createChannel();
 

Public API:

  • getChannelNumber
  • close

While a Channel can be used by multiple threads, it's important to ensure that only one thread executes a command at once. Concurrent execution of commands will likely cause an UnexpectedFrameError to be thrown.

Summary

Public Methods
abstract void abort(int closeCode, String closeMessage)
Abort this channel.
abstract void abort()
Abort this channel with the com.rabbitmq.client.AMQP close code and message 'OK'.
abstract void addConfirmListener(ConfirmListener listener)
abstract void addFlowListener(FlowListener listener)
abstract void addReturnListener(ReturnListener listener)
abstract void asyncRpc(Method method)
Asynchronously send a method over this channel.
abstract void basicAck(long deliveryTag, boolean multiple)
Acknowledge one or several received messages.
abstract void basicCancel(String consumerTag)
Cancel a consumer.
abstract String basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback)
Start a non-nolocal, non-exclusive consumer.
abstract String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<StringObject> arguments, Consumer callback)
Start a consumer.
abstract String basicConsume(String queue, boolean autoAck, Consumer callback)
Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.
abstract String basicConsume(String queue, Consumer callback)
Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.
abstract GetResponse basicGet(String queue, boolean autoAck)
Retrieve a message from a queue using com.rabbitmq.client.AMQP.Basic.Get
abstract void basicNack(long deliveryTag, boolean multiple, boolean requeue)
Reject one or several received messages.
abstract void basicPublish(String exchange, String routingKey, BasicProperties props, byte[] body)
Publish a message with both "mandatory" and "immediate" flags set to false
abstract void basicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, BasicProperties props, byte[] body)
Publish a message
abstract void basicQos(int prefetchCount)
Request a specific prefetchCount "quality of service" settings for this channel.
abstract void basicQos(int prefetchSize, int prefetchCount, boolean global)
Request specific "quality of service" settings.
abstract Basic.RecoverOk basicRecover()
Ask the broker to resend unacknowledged messages.
abstract Basic.RecoverOk basicRecover(boolean requeue)
Ask the broker to resend unacknowledged messages.
abstract void basicRecoverAsync(boolean requeue)
Ask the broker to resend unacknowledged messages.
abstract void basicReject(long deliveryTag, boolean requeue)
Reject a message.
abstract void clearConfirmListeners()
Remove all ConfirmListeners.
abstract void clearFlowListeners()
Remove all FlowListeners.
abstract void clearReturnListeners()
Remove all ReturnListeners.
abstract void close(int closeCode, String closeMessage)
Close this channel.
abstract void close()
Close this channel with the com.rabbitmq.client.AMQP close code and message 'OK'.
abstract Confirm.SelectOk confirmSelect()
Enables publisher acknowledgements on this channel.
abstract Exchange.BindOk exchangeBind(String destination, String source, String routingKey)
Bind an exchange to an exchange, with no extra arguments.
abstract Exchange.BindOk exchangeBind(String destination, String source, String routingKey, Map<StringObject> arguments)
Bind an exchange to an exchange.
abstract Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable)
Actively declare a non-autodelete exchange with no extra arguments
abstract Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, Map<StringObject> arguments)
Declare an exchange.
abstract Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<StringObject> arguments)
Declare an exchange, via an interface that allows the complete set of arguments.
abstract Exchange.DeclareOk exchangeDeclare(String exchange, String type)
Actively declare a non-autodelete, non-durable exchange with no extra arguments
abstract Exchange.DeclareOk exchangeDeclarePassive(String name)
Declare an exchange passively; that is, check if the named exchange exists.
abstract Exchange.DeleteOk exchangeDelete(String exchange, boolean ifUnused)
Delete an exchange
abstract Exchange.DeleteOk exchangeDelete(String exchange)
Delete an exchange, without regard for whether it is in use or not
abstract Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey)
Unbind an exchange from an exchange, with no extra arguments.
abstract Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<StringObject> arguments)
Unbind an exchange from an exchange.
abstract FlowOk flow(boolean active)
Set flow on the channel
abstract int getChannelNumber()
Retrieve this channel's channel number.
abstract Connection getConnection()
Retrieve the connection which carries this channel.
abstract Consumer getDefaultConsumer()
Get the current default consumer.
abstract FlowOk getFlow()
Return the current Channel.Flow settings.
abstract long getNextPublishSeqNo()
When in confirm mode, returns the sequence number of the next message to be published.
abstract Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<StringObject> arguments)
Bind a queue to an exchange.
abstract Queue.BindOk queueBind(String queue, String exchange, String routingKey)
Bind a queue to an exchange, with no extra arguments.
abstract Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<StringObject> arguments)
Declare a queue
abstract Queue.DeclareOk queueDeclare()
Actively declare a server-named exclusive, autodelete, non-durable queue.
abstract Queue.DeclareOk queueDeclarePassive(String queue)
Declare a queue passively; i.e., check if it exists.
abstract Queue.DeleteOk queueDelete(String queue)
Delete a queue, without regard for whether it is in use or has messages on it
abstract Queue.DeleteOk queueDelete(String queue, boolean ifUnused, boolean ifEmpty)
Delete a queue
abstract Queue.PurgeOk queuePurge(String queue)
Purges the contents of the given queue.
abstract Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<StringObject> arguments)
Unbind a queue from an exchange.
abstract Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey)
Unbinds a queue from an exchange, with no extra arguments.
abstract boolean removeConfirmListener(ConfirmListener listener)
Remove a ConfirmListener.
abstract boolean removeFlowListener(FlowListener listener)
Remove a FlowListener.
abstract boolean removeReturnListener(ReturnListener listener)
Remove a ReturnListener.
abstract Command rpc(Method method)
Synchronously send a method over this channel.
abstract void setDefaultConsumer(Consumer consumer)
Set the current default consumer.
abstract Tx.CommitOk txCommit()
Commits a TX transaction on this channel.
abstract Tx.RollbackOk txRollback()
Rolls back a TX transaction on this channel.
abstract Tx.SelectOk txSelect()
Enables TX mode on this channel.
abstract boolean waitForConfirms()
Wait until all messages published since the last call have been either ack'd or nack'd by the broker.
abstract void waitForConfirmsOrDie()
Wait until all messages published since the last call have been either ack'd or nack'd by the broker.
[Expand]
Inherited Methods
From interface com.rabbitmq.client.ShutdownNotifier

Public Methods

public abstract void abort (int closeCode, String closeMessage)

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.

Throws
IOException

public abstract void abort ()

Abort this channel with the com.rabbitmq.client.AMQP 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.

Throws
IOException

public abstract void addConfirmListener (ConfirmListener listener)

Parameters
listener the listener to add

public abstract void addFlowListener (FlowListener listener)

Parameters
listener the listener to add

public abstract void addReturnListener (ReturnListener listener)

Parameters
listener the listener to add

public abstract void asyncRpc (Method method)

Asynchronously send a method over this channel.

Parameters
method method to transmit over this channel.
Throws
IOException Problem transmitting method.

public abstract void basicAck (long deliveryTag, boolean multiple)

Acknowledge one or several received messages. Supply the deliveryTag from the com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver method containing the received message being acknowledged.

Parameters
deliveryTag the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Ack

public abstract void basicCancel (String consumerTag)

Cancel a consumer. Calls the consumer's handleCancelOk(String) method.

Parameters
consumerTag a client- or server-generated consumer tag to establish context
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Cancel
  • com.rabbitmq.client.AMQP.Basic.CancelOk

public abstract String basicConsume (String queue, boolean autoAck, String consumerTag, Consumer callback)

Start a non-nolocal, non-exclusive consumer.

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
IOException if an error is encountered
See Also

public abstract String basicConsume (String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<StringObject> arguments, Consumer callback)

Start a consumer. Calls the consumer's handleConsumeOk(String) method.

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 flag set to true unless server local buffering is required
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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Consume
  • com.rabbitmq.client.AMQP.Basic.ConsumeOk

public abstract String basicConsume (String queue, boolean autoAck, Consumer callback)

Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.

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
IOException if an error is encountered
See Also

public abstract String basicConsume (String queue, Consumer callback)

Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.

Parameters
queue the name of the queue
callback an interface to the consumer object
Returns
  • the consumerTag generated by the server
Throws
IOException if an error is encountered
See Also

public abstract GetResponse basicGet (String queue, boolean autoAck)

Retrieve a message from a queue using com.rabbitmq.client.AMQP.Basic.Get

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
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Get
  • com.rabbitmq.client.AMQP.Basic.GetOk
  • com.rabbitmq.client.AMQP.Basic.GetEmpty

public abstract void basicNack (long deliveryTag, boolean multiple, boolean requeue)

Reject one or several received messages. Supply the deliveryTag from the com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.GetOk method containing the message to be rejected.

Parameters
deliveryTag the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Nack

public abstract void basicPublish (String exchange, String routingKey, BasicProperties props, byte[] body)

Publish a message with both "mandatory" and "immediate" flags set to false

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Publish

public abstract void basicPublish (String exchange, String routingKey, boolean mandatory, boolean immediate, BasicProperties props, byte[] body)

Publish a message

Parameters
exchange the exchange to publish the message to
routingKey the routing key
mandatory true if we are requesting a mandatory publish
immediate true if we are requesting an immediate publish
props other properties for the message - routing headers etc
body the message body
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Publish

public abstract void basicQos (int prefetchCount)

Request a specific prefetchCount "quality of service" settings for this channel.

Parameters
prefetchCount maximum number of messages that the server will deliver, 0 if unlimited
Throws
IOException if an error is encountered

public abstract void basicQos (int prefetchSize, int prefetchCount, boolean global)

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.

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 connection rather than just the current channel
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Qos

public abstract Basic.RecoverOk basicRecover ()

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.

Throws
IOException

public abstract Basic.RecoverOk basicRecover (boolean requeue)

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.

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
IOException

public abstract void basicRecoverAsync (boolean requeue)

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 and deprecated.

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
IOException

public abstract void basicReject (long deliveryTag, boolean requeue)

Reject a message. Supply the deliveryTag from the com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver method containing the received message being rejected.

Parameters
deliveryTag the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver
requeue true if the rejected message should be requeued rather than discarded/dead-lettered
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Basic.Reject

public abstract void clearConfirmListeners ()

Remove all ConfirmListeners.

public abstract void clearFlowListeners ()

Remove all FlowListeners.

public abstract void clearReturnListeners ()

Remove all ReturnListeners.

public abstract void close (int closeCode, String closeMessage)

Close this 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
IOException if an error is encountered

public abstract void close ()

Close this channel with the com.rabbitmq.client.AMQP close code and message 'OK'.

Throws
IOException if an error is encountered

public abstract Confirm.SelectOk confirmSelect ()

Enables publisher acknowledgements on this channel.

Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Confirm.Select

public abstract Exchange.BindOk exchangeBind (String destination, String source, String routingKey)

Bind an exchange to an exchange, with no extra arguments.

Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Bind
  • com.rabbitmq.client.AMQP.Exchange.BindOk

public abstract Exchange.BindOk exchangeBind (String destination, String source, String routingKey, Map<StringObject> arguments)

Bind an exchange to an exchange.

Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Bind
  • com.rabbitmq.client.AMQP.Exchange.BindOk

public abstract Exchange.DeclareOk exchangeDeclare (String exchange, String type, boolean durable)

Actively declare a non-autodelete exchange with no extra arguments

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Declare
  • com.rabbitmq.client.AMQP.Exchange.DeclareOk

public abstract Exchange.DeclareOk exchangeDeclare (String exchange, String type, boolean durable, boolean autoDelete, Map<StringObject> arguments)

Declare an exchange.

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Declare
  • com.rabbitmq.client.AMQP.Exchange.DeclareOk

public abstract Exchange.DeclareOk exchangeDeclare (String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<StringObject> arguments)

Declare an exchange, via an interface that allows the complete set of arguments.

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Declare
  • com.rabbitmq.client.AMQP.Exchange.DeclareOk

public abstract Exchange.DeclareOk exchangeDeclare (String exchange, String type)

Actively declare a non-autodelete, non-durable exchange with no extra arguments

Parameters
exchange the name of the exchange
type the exchange type
Returns
  • a declaration-confirm method to indicate the exchange was successfully declared
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Declare
  • com.rabbitmq.client.AMQP.Exchange.DeclareOk

public abstract Exchange.DeclareOk exchangeDeclarePassive (String name)

Declare an exchange passively; that is, check if the named exchange exists.

Parameters
name check the existence of an exchange named this
Throws
IOException the server will raise a 404 channel exception if the named exchange does not exist.

public abstract Exchange.DeleteOk exchangeDelete (String exchange, boolean ifUnused)

Delete an exchange

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Delete
  • com.rabbitmq.client.AMQP.Exchange.DeleteOk

public abstract Exchange.DeleteOk exchangeDelete (String exchange)

Delete an exchange, without regard for whether it is in use or not

Parameters
exchange the name of the exchange
Returns
  • a deletion-confirm method to indicate the exchange was successfully deleted
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Delete
  • com.rabbitmq.client.AMQP.Exchange.DeleteOk

public abstract Exchange.UnbindOk exchangeUnbind (String destination, String source, String routingKey)

Unbind an exchange from an exchange, with no extra arguments.

Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Bind
  • com.rabbitmq.client.AMQP.Exchange.BindOk

public abstract Exchange.UnbindOk exchangeUnbind (String destination, String source, String routingKey, Map<StringObject> arguments)

Unbind an exchange from an exchange.

Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Exchange.Bind
  • com.rabbitmq.client.AMQP.Exchange.BindOk

public abstract FlowOk flow (boolean active)

Set flow on the channel

Parameters
active if true, the server is asked to start sending. If false, the server is asked to stop sending.
Throws
IOException

public abstract int getChannelNumber ()

Retrieve this channel's channel number.

Returns
  • the channel number

public abstract Connection getConnection ()

Retrieve the connection which carries this channel.

Returns

public abstract Consumer getDefaultConsumer ()

Get the current default consumer. @see setDefaultConsumer for rationale.

Returns
  • an interface to the current default consumer.

public abstract FlowOk getFlow ()

Return the current Channel.Flow settings.

public abstract long getNextPublishSeqNo ()

When in confirm mode, returns the sequence number of the next message to be published.

Returns
  • the sequence number of the next message to be published

public abstract Queue.BindOk queueBind (String queue, String exchange, String routingKey, Map<StringObject> arguments)

Bind a queue to an exchange.

Parameters
queue the name of the queue
exchange the name of the exchange
routingKey the routine key to use for the binding
arguments other properties (binding parameters)
Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Bind
  • com.rabbitmq.client.AMQP.Queue.BindOk

public abstract Queue.BindOk queueBind (String queue, String exchange, String routingKey)

Bind a queue to an exchange, with no extra arguments.

Parameters
queue the name of the queue
exchange the name of the exchange
routingKey the routine key to use for the binding
Returns
  • a binding-confirm method if the binding was successfully created
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Bind
  • com.rabbitmq.client.AMQP.Queue.BindOk

public abstract Queue.DeclareOk queueDeclare (String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<StringObject> arguments)

Declare a queue

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Declare
  • com.rabbitmq.client.AMQP.Queue.DeclareOk

public abstract Queue.DeclareOk queueDeclare ()

Actively declare a server-named exclusive, autodelete, non-durable queue. The name of the new queue is held in the "queue" field of the com.rabbitmq.client.AMQP.Queue.DeclareOk result.

Returns
  • a declaration-confirm method to indicate the queue was successfully declared
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Declare
  • com.rabbitmq.client.AMQP.Queue.DeclareOk

public abstract Queue.DeclareOk queueDeclarePassive (String queue)

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.

Parameters
queue the name of the queue
Returns
  • a declaration-confirm method to indicate the queue exists
Throws
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
  • com.rabbitmq.client.AMQP.Queue.Declare
  • com.rabbitmq.client.AMQP.Queue.DeclareOk

public abstract Queue.DeleteOk queueDelete (String queue)

Delete a queue, without regard for whether it is in use or has messages on it

Parameters
queue the name of the queue
Returns
  • a deletion-confirm method to indicate the queue was successfully deleted
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Delete
  • com.rabbitmq.client.AMQP.Queue.DeleteOk

public abstract Queue.DeleteOk queueDelete (String queue, boolean ifUnused, boolean ifEmpty)

Delete a queue

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
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Delete
  • com.rabbitmq.client.AMQP.Queue.DeleteOk

public abstract Queue.PurgeOk queuePurge (String queue)

Purges the contents of the given queue.

Parameters
queue the name of the queue
Returns
  • a purge-confirm method if the purge was executed succesfully
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Purge
  • com.rabbitmq.client.AMQP.Queue.PurgeOk

public abstract Queue.UnbindOk queueUnbind (String queue, String exchange, String routingKey, Map<StringObject> arguments)

Unbind a queue from an exchange.

Parameters
queue the name of the queue
exchange the name of the exchange
routingKey the routine key to use for the binding
arguments other properties (binding parameters)
Returns
  • an unbinding-confirm method if the binding was successfully deleted
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Unbind
  • com.rabbitmq.client.AMQP.Queue.UnbindOk

public abstract Queue.UnbindOk queueUnbind (String queue, String exchange, String routingKey)

Unbinds a queue from an exchange, with no extra arguments.

Parameters
queue the name of the queue
exchange the name of the exchange
routingKey the routine key to use for the binding
Returns
  • an unbinding-confirm method if the binding was successfully deleted
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Queue.Unbind
  • com.rabbitmq.client.AMQP.Queue.UnbindOk

public abstract boolean removeConfirmListener (ConfirmListener listener)

Remove a ConfirmListener.

Parameters
listener the listener to remove
Returns
  • true if the listener was found and removed, false otherwise

public abstract boolean removeFlowListener (FlowListener listener)

Remove a FlowListener.

Parameters
listener the listener to remove
Returns
  • true if the listener was found and removed, false otherwise

public abstract boolean removeReturnListener (ReturnListener listener)

Remove a ReturnListener.

Parameters
listener the listener to remove
Returns
  • true if the listener was found and removed, false otherwise

public abstract Command rpc (Method method)

Synchronously send a method over this channel.

Parameters
method method to transmit over this channel.
Returns
  • command response to method. Caller should cast as appropriate.
Throws
IOException Problem transmitting method.

public abstract void setDefaultConsumer (Consumer consumer)

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.

Parameters
consumer the consumer to use, or null indicating "don't use one".

public abstract Tx.CommitOk txCommit ()

Commits a TX transaction on this channel.

Returns
  • a transaction-commit method to indicate the transaction was successfully committed
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Tx.Commit
  • com.rabbitmq.client.AMQP.Tx.CommitOk

public abstract Tx.RollbackOk txRollback ()

Rolls back a TX transaction on this channel.

Returns
  • a transaction-rollback method to indicate the transaction was successfully rolled back
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Tx.Rollback
  • com.rabbitmq.client.AMQP.Tx.RollbackOk

public abstract Tx.SelectOk txSelect ()

Enables TX mode on this channel.

Returns
  • a transaction-selection method to indicate the transaction was successfully initiated
Throws
IOException if an error is encountered
See Also
  • com.rabbitmq.client.AMQP.Tx.Select
  • com.rabbitmq.client.AMQP.Tx.SelectOk

public abstract boolean waitForConfirms ()

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 returns true immediately.

Returns
  • whether all the messages were ack'd (and none were nack'd)

public abstract void waitForConfirmsOrDie ()

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 return immediately.