Interface Channel
- All Superinterfaces:
AutoCloseable,ShutdownNotifier
- All Known Subinterfaces:
RecoverableChannel
- All Known Implementing Classes:
AutorecoveringChannel,ChannelN,RecoveryAwareChannelN
Tutorials
RabbitMQ tutorials demonstrate how key methods of this interface are used.User Guide
See Java Client User Guide.Concurrency Considerations
Channel instances must not be shared between
threads. Applications
should prefer using a Channel per thread
instead of sharing the same Channel across
multiple threads. While some operations on channels are safe to invoke
concurrently, some are not and will result in incorrect frame interleaving
on the wire. Sharing channels between threads will also interfere with
Publisher Confirms.
As such, applications need to use a Channel per thread.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.voidAbort this channel.addConfirmListener(ConfirmCallback ackCallback, ConfirmCallback nackCallback) Add a lambda-basedConfirmListener.voidaddConfirmListener(ConfirmListener listener) Add aConfirmListener.addReturnListener(ReturnCallback returnCallback) Add a lambda-basedReturnListener.voidaddReturnListener(ReturnListener listener) Add aReturnListener.asyncCompletableRpc(Method method) Asynchronously send a method over this channel.voidAsynchronously send a method over this channel.voidbasicAck(long deliveryTag, boolean multiple) Acknowledge one or several received messages.voidbasicCancel(String consumerTag) Cancel a consumer.basicConsume(String queue, boolean autoAck, Consumer callback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer.Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.basicConsume(String queue, Consumer callback) Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.Retrieve a message from a queue usingAMQP.Basic.GetvoidbasicNack(long deliveryTag, boolean multiple, boolean requeue) Reject one or several received messages.voidbasicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, AMQP.BasicProperties props, byte[] body) Publish a message.voidbasicPublish(String exchange, String routingKey, boolean mandatory, AMQP.BasicProperties props, byte[] body) Publish a message.voidbasicPublish(String exchange, String routingKey, AMQP.BasicProperties props, byte[] body) Publish a message.voidbasicQos(int prefetchCount) Request a specific prefetchCount "quality of service" settings for this channel.voidbasicQos(int prefetchCount, boolean global) Request a specific prefetchCount "quality of service" settings for this channel.voidbasicQos(int prefetchSize, int prefetchCount, boolean global) Request specific "quality of service" settings.Ask the broker to resend unacknowledged messages.basicRecover(boolean requeue) Ask the broker to resend unacknowledged messages.voidbasicReject(long deliveryTag, boolean requeue) Reject a message.voidRemove allConfirmListeners.voidRemove allReturnListeners.voidclose()Close this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.voidClose this channel.Enables publisher acknowledgements on this channel.longconsumerCount(String queue) Returns the number of consumers on a queue.exchangeBind(String destination, String source, String routingKey) Bind an exchange to an exchange, with no extra arguments.Bind an exchange to an exchange.voidexchangeBindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) LikeexchangeBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).exchangeDeclare(String exchange, BuiltinExchangeType type) Actively declare a non-autodelete, non-durable exchange with no extra argumentsexchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable) Actively declare a non-autodelete exchange with no extra argumentsexchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) Declare an exchange, via an interface that allows the complete set of arguments.exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, Map<String, Object> arguments) Declare an exchange.exchangeDeclare(String exchange, String type) Actively declare a non-autodelete, non-durable exchange with no extra argumentsexchangeDeclare(String exchange, String type, boolean durable) Actively declare a non-autodelete exchange with no extra argumentsexchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) Declare an exchange, via an interface that allows the complete set of arguments.exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, Map<String, Object> arguments) Declare an exchange.voidexchangeDeclareNoWait(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) LikeexchangeDeclare(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).voidexchangeDeclareNoWait(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) LikeexchangeDeclare(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).exchangeDeclarePassive(String name) Declare an exchange passively; that is, check if the named exchange exists.exchangeDelete(String exchange) Delete an exchange, without regard for whether it is in use or notexchangeDelete(String exchange, boolean ifUnused) Delete an exchangevoidexchangeDeleteNoWait(String exchange, boolean ifUnused) LikeexchangeDelete(String, boolean)but sets nowait parameter to true and returns void (as there will be no response from the server).exchangeUnbind(String destination, String source, String routingKey) Unbind an exchange from an exchange, with no extra arguments.Unbind an exchange from an exchange.voidexchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) Same asexchangeUnbind(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).intRetrieve this channel's channel number.Retrieve the connection which carries this channel.Get the current default consumer.longWhen in confirm mode, returns the sequence number of the next message to be published.longmessageCount(String queue) Returns the number of messages in a queue ready to be delivered to consumers.Bind a queue to an exchange, with no extra arguments.Bind a queue to an exchange.voidSame asqueueBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).Actively declare a server-named exclusive, autodelete, non-durable queue.queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) Declare a queuevoidqueueDeclareNoWait(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) LikequeueDeclare(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).queueDeclarePassive(String queue) Declare a queue passively; i.e., check if it exists.queueDelete(String queue) Delete a queue, without regard for whether it is in use or has messages on itqueueDelete(String queue, boolean ifUnused, boolean ifEmpty) Delete a queuevoidqueueDeleteNoWait(String queue, boolean ifUnused, boolean ifEmpty) LikequeueDelete(String, boolean, boolean)but sets nowait parameter to true and returns nothing (as there will be no response from the server).queuePurge(String queue) Purges the contents of the given queue.queueUnbind(String queue, String exchange, String routingKey) Unbinds a queue from an exchange, with no extra arguments.Unbind a queue from an exchange.booleanremoveConfirmListener(ConfirmListener listener) Remove aConfirmListener.booleanremoveReturnListener(ReturnListener listener) Remove aReturnListener.Synchronously send a method over this channel.voidsetDefaultConsumer(Consumer consumer) Set the current default consumer.txCommit()Commits a TX transaction on this channel.Rolls back a TX transaction on this channel.txSelect()Enables TX mode on this channel.booleanWait until all messages published since the last call have been either ack'd or nack'd by the broker.booleanwaitForConfirms(long timeout) Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses.voidWait until all messages published since the last call have been either ack'd or nack'd by the broker.voidwaitForConfirmsOrDie(long timeout) Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses.Methods inherited from interface com.rabbitmq.client.ShutdownNotifier
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
-
Method Details
-
getChannelNumber
int getChannelNumber()Retrieve this channel's channel number.- Returns:
- the channel number
-
getConnection
Connection getConnection()Retrieve the connection which carries this channel.- Returns:
- the underlying
Connection
-
close
Close this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if an error is encounteredTimeoutException
-
close
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 encounteredTimeoutException
-
abort
Abort this channel with theAMQP.REPLY_SUCCESSclose 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
-
abort
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
-
addReturnListener
Add aReturnListener.- Parameters:
listener- the listener to add
-
addReturnListener
Add a lambda-basedReturnListener.- Parameters:
returnCallback- the callback when the message is returned- Returns:
- the listener that wraps the callback
- See Also:
-
removeReturnListener
Remove aReturnListener.- Parameters:
listener- the listener to remove- Returns:
trueif the listener was found and removed,falseotherwise
-
clearReturnListeners
void clearReturnListeners()Remove allReturnListeners. -
addConfirmListener
Add aConfirmListener.- Parameters:
listener- the listener to add
-
addConfirmListener
Add a lambda-basedConfirmListener.- Parameters:
ackCallback- callback on acknackCallback- call on nack (negative ack)- Returns:
- the listener that wraps the callbacks
- See Also:
-
removeConfirmListener
Remove aConfirmListener.- Parameters:
listener- the listener to remove- Returns:
trueif the listener was found and removed,falseotherwise
-
clearConfirmListeners
void clearConfirmListeners()Remove allConfirmListeners. -
getDefaultConsumer
Consumer getDefaultConsumer()Get the current default consumer. @see setDefaultConsumer for rationale.- Returns:
- an interface to the current default consumer.
-
setDefaultConsumer
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".
-
basicQos
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).
- Parameters:
prefetchSize- maximum amount of content (measured in octets) that the server will deliver, 0 if unlimitedprefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Throws:
IOException- if an error is encountered- See Also:
-
basicQos
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).
- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Throws:
IOException- if an error is encountered- See Also:
-
basicQos
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).
- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimited- Throws:
IOException- if an error is encountered- See Also:
-
basicPublish
void basicPublish(String exchange, String routingKey, AMQP.BasicProperties props, byte[] body) throws IOException Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations ofChannel#basicPublishwill eventually block if a resource-driven alarm is in effect.- Parameters:
exchange- the exchange to publish the message toroutingKey- the routing keyprops- other properties for the message - routing headers etcbody- the message body- Throws:
IOException- if an error is encountered- See Also:
-
basicPublish
void basicPublish(String exchange, String routingKey, boolean mandatory, AMQP.BasicProperties props, byte[] body) throws IOException Publish a message. Invocations ofChannel#basicPublishwill eventually block if a resource-driven alarm is in effect.- Parameters:
exchange- the exchange to publish the message toroutingKey- the routing keymandatory- true if the 'mandatory' flag is to be setprops- other properties for the message - routing headers etcbody- the message body- Throws:
IOException- if an error is encountered- See Also:
-
basicPublish
void basicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, AMQP.BasicProperties props, byte[] body) throws IOException Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations ofChannel#basicPublishwill eventually block if a resource-driven alarm is in effect.- Parameters:
exchange- the exchange to publish the message toroutingKey- the routing keymandatory- true if the 'mandatory' flag is to be setimmediate- 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 etcbody- the message body- Throws:
IOException- if an error is encountered- See Also:
-
exchangeDeclare
Actively declare a non-autodelete, non-durable exchange with no extra arguments- Parameters:
exchange- the name of the exchangetype- the exchange type- Returns:
- a declaration-confirm method to indicate the exchange was successfully declared
- Throws:
IOException- if an error is encountered- See Also:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type) throws IOException Actively declare a non-autodelete, non-durable exchange with no extra arguments- Parameters:
exchange- the name of the exchangetype- the exchange type- Returns:
- a declaration-confirm method to indicate the exchange was successfully declared
- Throws:
IOException- if an error is encountered- See Also:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable) throws IOException Actively declare a non-autodelete exchange with no extra arguments- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable) throws IOException Actively declare a non-autodelete exchange with no extra arguments- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionDeclare an exchange.- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 usearguments- 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:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionDeclare an exchange.- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 usearguments- 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:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionDeclare an exchange, via an interface that allows the complete set of arguments.- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 useinternal- 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:
-
exchangeDeclare
AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionDeclare an exchange, via an interface that allows the complete set of arguments.- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 useinternal- 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:
-
exchangeDeclareNoWait
void exchangeDeclareNoWait(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionLikeexchangeDeclare(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).- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 useinternal- 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:
IOException- if an error is encountered
-
exchangeDeclareNoWait
void exchangeDeclareNoWait(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionLikeexchangeDeclare(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).- Parameters:
exchange- the name of the exchangetype- the exchange typedurable- 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 useinternal- 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:
IOException- if an error is encountered
-
exchangeDeclarePassive
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.
-
exchangeDelete
Delete an exchange- Parameters:
exchange- the name of the exchangeifUnused- 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:
-
exchangeDeleteNoWait
LikeexchangeDelete(String, boolean)but sets nowait parameter to true and returns void (as there will be no response from the server).- Parameters:
exchange- the name of the exchangeifUnused- true to indicate that the exchange is only to be deleted if it is unused- Throws:
IOException- if an error is encountered- See Also:
-
exchangeDelete
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:
-
exchangeBind
AMQP.Exchange.BindOk exchangeBind(String destination, String source, String routingKey) throws IOException Bind an exchange to an exchange, with no extra arguments.- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing 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:
-
exchangeBind
AMQP.Exchange.BindOk exchangeBind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionBind an exchange to an exchange.- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Returns:
- a binding-confirm method if the binding was successfully created
- Throws:
IOException- if an error is encountered- See Also:
-
exchangeBindNoWait
void exchangeBindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionLikeexchangeBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Throws:
IOException- if an error is encountered
-
exchangeUnbind
AMQP.Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey) throws IOException Unbind an exchange from an exchange, with no extra arguments.- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing 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:
-
exchangeUnbind
AMQP.Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionUnbind an exchange from an exchange.- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Returns:
- a binding-confirm method if the binding was successfully created
- Throws:
IOException- if an error is encountered- See Also:
-
exchangeUnbindNoWait
void exchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionSame asexchangeUnbind(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).- Parameters:
destination- the name of the exchange to which messages flow across the bindingsource- the name of the exchange from which messages flow across the bindingroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Throws:
IOException- if an error is encountered
-
queueDeclare
Actively declare a server-named exclusive, autodelete, non-durable queue. The name of the new queue is held in the "queue" field of theAMQP.Queue.DeclareOkresult.- Returns:
- a declaration-confirm method to indicate the queue was successfully declared
- Throws:
IOException- if an error is encountered- See Also:
-
queueDeclare
AMQP.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionDeclare a queue- Parameters:
queue- the name of the queuedurable- 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:
-
queueDeclareNoWait
void queueDeclareNoWait(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionLikequeueDeclare(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).- Parameters:
queue- the name of the queuedurable- 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:
IOException- if an error is encountered
-
queueDeclarePassive
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:
-
queueDelete
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:
-
queueDelete
Delete a queue- Parameters:
queue- the name of the queueifUnused- true if the queue should be deleted only if not in useifEmpty- 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:
-
queueDeleteNoWait
LikequeueDelete(String, boolean, boolean)but sets nowait parameter to true and returns nothing (as there will be no response from the server).- Parameters:
queue- the name of the queueifUnused- true if the queue should be deleted only if not in useifEmpty- true if the queue should be deleted only if empty- Throws:
IOException- if an error is encountered- See Also:
-
queueBind
Bind a queue to an exchange, with no extra arguments.- Parameters:
queue- the name of the queueexchange- the name of the exchangeroutingKey- the routing 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:
-
queueBind
AMQP.Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionBind a queue to an exchange.- Parameters:
queue- the name of the queueexchange- the name of the exchangeroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Returns:
- a binding-confirm method if the binding was successfully created
- Throws:
IOException- if an error is encountered- See Also:
-
queueBindNoWait
void queueBindNoWait(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionSame asqueueBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).- Parameters:
queue- the name of the queueexchange- the name of the exchangeroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Throws:
IOException- if an error is encountered
-
queueUnbind
AMQP.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey) throws IOException Unbinds a queue from an exchange, with no extra arguments.- Parameters:
queue- the name of the queueexchange- the name of the exchangeroutingKey- the routing 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:
-
queueUnbind
AMQP.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionUnbind a queue from an exchange.- Parameters:
queue- the name of the queueexchange- the name of the exchangeroutingKey- the routing key to use for the bindingarguments- other properties (binding parameters)- Returns:
- an unbinding-confirm method if the binding was successfully deleted
- Throws:
IOException- if an error is encountered- See Also:
-
queuePurge
Purges the contents of the given queue.- Parameters:
queue- the name of the queue- Returns:
- a purge-confirm method if the purge was executed successfully
- Throws:
IOException- if an error is encountered- See Also:
-
basicGet
Retrieve a message from a queue usingAMQP.Basic.Get- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements- Returns:
- a
GetResponsecontaining the retrieved message data - Throws:
IOException- if an error is encountered- See Also:
-
basicAck
Acknowledge one or several received messages. Supply the deliveryTag from theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the received message being acknowledged.- Parameters:
deliveryTag- the tag from the receivedAMQP.Basic.GetOkorAMQP.Basic.Delivermultiple- 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:
-
basicNack
Reject one or several received messages. Supply thedeliveryTagfrom theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the message to be rejected.- Parameters:
deliveryTag- the tag from the receivedAMQP.Basic.GetOkorAMQP.Basic.Delivermultiple- 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:
-
basicReject
Reject a message. Supply the deliveryTag from theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the received message being rejected.- Parameters:
deliveryTag- the tag from the receivedAMQP.Basic.GetOkorAMQP.Basic.Deliverrequeue- true if the rejected message should be requeued rather than discarded/dead-lettered- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.- Parameters:
queue- the name of the queuecallback- an interface to the consumer object- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag. Provide access only tobasic.deliverandbasic.cancelAMQP methods (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queuedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelled- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag. Provide access only tobasic.deliverand shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queuedeliverCallback- callback when a message is deliveredshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag. Provide access tobasic.deliver,basic.canceland shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queuedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelledshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementscallback- an interface to the consumer object- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access only tobasic.deliverandbasic.cancelAMQP methods (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsdeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelled- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access only tobasic.deliverand shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsdeliverCallback- callback when a message is deliveredshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag. Provide access tobasic.deliver,basic.canceland shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsdeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelledshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, Consumer callback) throws IOExceptionStart a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsarguments- a set of arguments for the consumecallback- an interface to the consumer object- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOExceptionStart a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access only tobasic.deliverandbasic.cancelAMQP methods (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelled- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionStart a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access only tobasic.deliverand shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionStart a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments. Provide access tobasic.deliver,basic.canceland shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelledshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag generated by the server
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) throws IOException Start a non-nolocal, non-exclusive consumer.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextcallback- an interface to the consumer object- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Start a non-nolocal, non-exclusive consumer. Provide access only tobasic.deliverandbasic.cancelAMQP methods (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextdeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelled- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer. Provide access only tobasic.deliverand shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextdeliverCallback- callback when a message is deliveredshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Start a non-nolocal, non-exclusive consumer. Provide access tobasic.deliver,basic.canceland shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextdeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelledshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOExceptionStart a consumer. Calls the consumer'sConsumer.handleConsumeOk(java.lang.String)method.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextnoLocal- 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 consumerarguments- a set of arguments for the consumecallback- an interface to the consumer object- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOExceptionStart a consumer. Calls the consumer'sConsumer.handleConsumeOk(java.lang.String)method. Provide access only tobasic.deliverandbasic.cancelAMQP methods (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextnoLocal- 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 consumerarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelled- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionStart a consumer. Calls the consumer'sConsumer.handleConsumeOk(java.lang.String)method. Provide access only tobasic.deliverand shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextnoLocal- 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 consumerarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicConsume
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionStart a consumer. Calls the consumer'sConsumer.handleConsumeOk(java.lang.String)method. Provide access tobasic.deliver,basic.canceland shutdown signal callbacks (which is sufficient for most cases). See methods with aConsumerargument to have access to all the application callbacks.- Parameters:
queue- the name of the queueautoAck- true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgementsconsumerTag- a client-generated consumer tag to establish contextnoLocal- 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 consumerarguments- a set of arguments for the consumedeliverCallback- callback when a message is deliveredcancelCallback- callback when the consumer is cancelledshutdownSignalCallback- callback when the channel/connection is shut down- Returns:
- the consumerTag associated with the new consumer
- Throws:
IOException- if an error is encountered- Since:
- 5.0
- See Also:
-
basicCancel
Cancel a consumer. Calls the consumer'sConsumer.handleCancelOk(java.lang.String)method.- Parameters:
consumerTag- a client- or server-generated consumer tag to establish context- Throws:
IOException- if an error is encountered, or if the consumerTag is unknown- See Also:
-
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 callingbasicRecover(true), messages will be requeued and possibly delivered to a different consumer.- Throws:
IOException- See Also:
-
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.- 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
-
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:
-
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:
-
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:
-
confirmSelect
Enables publisher acknowledgements on this channel.- Throws:
IOException- if an error is encountered- See Also:
-
getNextPublishSeqNo
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
-
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 throws an IllegalStateException.- Returns:
- whether all the messages were ack'd (and none were nack'd)
- Throws:
IllegalStateExceptionInterruptedException
-
waitForConfirms
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.- Returns:
- whether all the messages were ack'd (and none were nack'd)
- Throws:
IllegalStateExceptionInterruptedExceptionTimeoutException
-
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 throw an IllegalStateException. -
waitForConfirmsOrDie
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. -
asyncRpc
Asynchronously send a method over this channel.- Parameters:
method- method to transmit over this channel.- Throws:
IOException- Problem transmitting method.
-
rpc
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.
-
messageCount
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.- Parameters:
queue- the name of the queue- Returns:
- the number of messages in ready state
- Throws:
IOException- Problem transmitting method.
-
consumerCount
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.- Parameters:
queue- the name of the queue- Returns:
- the number of consumers
- Throws:
IOException- Problem transmitting method.
-
asyncCompletableRpc
Asynchronously send a method over this channel.- Parameters:
method- method to transmit over this channel.- Returns:
- a completable future that completes when the result is received
- Throws:
IOException- Problem transmitting method.
-