Package com.rabbitmq.client.impl
Class ChannelN
java.lang.Object
com.rabbitmq.client.impl.ShutdownNotifierComponent
com.rabbitmq.client.impl.AMQChannel
com.rabbitmq.client.impl.ChannelN
- All Implemented Interfaces:
Channel,ShutdownNotifier,AutoCloseable
- Direct Known Subclasses:
RecoveryAwareChannelN
Main interface to AMQP protocol functionality. Public API -
Implementation of all AMQChannels except channel zero.
To open a channel,
Connectionconn = ...;ChannelNch1 = conn.createChannel();
-
Nested Class Summary
Nested classes/interfaces inherited from class com.rabbitmq.client.impl.AMQChannel
AMQChannel.BlockingRpcContinuation<T>, AMQChannel.RpcContinuation, AMQChannel.SimpleBlockingRpcContinuation -
Field Summary
FieldsFields inherited from class com.rabbitmq.client.impl.AMQChannel
_blockContent, _channelLock, _channelLockCondition, _rpcTimeout, NO_RPC_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService) Construct a new channel on the given connection with the given channel number.ChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService, MetricsCollector metricsCollector, ObservationCollector observationCollector) Construct a new channel on the given connection with the given channel number. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Public API - Abort this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.voidPublic API - Abort 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) Public API - Acknowledge one or several received messages.voidbasicCancel(String consumerTag) Public API - Cancel a consumer.basicConsume(String queue, boolean autoAck, Consumer callback) Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) Public API - 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) Public API - 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) Public API - Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) Public API - 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) Public API - Start a consumer.basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) Public API - Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) Public API - Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Public API - Start a non-nolocal, non-exclusive consumer.basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Public API - Start a non-nolocal, non-exclusive consumer.Public API - 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) Public API - 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) Public API - 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) Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.basicConsume(String queue, Consumer callback) Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.basicConsume(String queue, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.Public API - Retrieve a message from a queue usingAMQP.Basic.GetvoidbasicNack(long deliveryTag, boolean multiple, boolean requeue) Public API - Reject one or several received messages.voidbasicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, AMQP.BasicProperties props, byte[] body) Public API - Publish a message.voidbasicPublish(String exchange, String routingKey, boolean mandatory, AMQP.BasicProperties props, byte[] body) Public API - Publish a message.voidbasicPublish(String exchange, String routingKey, AMQP.BasicProperties props, byte[] body) Public API - Publish a message.voidbasicQos(int prefetchCount) Public API - Request a specific prefetchCount "quality of service" settings for this channel.voidbasicQos(int prefetchCount, boolean global) Public API - Request a specific prefetchCount "quality of service" settings for this channel.voidbasicQos(int prefetchSize, int prefetchCount, boolean global) Public API - Request specific "quality of service" settings.Public API - Ask the broker to resend unacknowledged messages.basicRecover(boolean requeue) Public API - Ask the broker to resend unacknowledged messages.voidbasicReject(long deliveryTag, boolean requeue) Public API - Reject a message.voidRemove allConfirmListeners.voidRemove allReturnListeners.voidclose()Public API - Close this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.voidPublic API - Close this channel.protected voidclose(int closeCode, String closeMessage, boolean initiatedByApplication, Throwable cause, boolean abort) Protected API - Close channel with code and message, indicating the source of the closure and a causing exception (null if none).Public API - Enables publisher acknowledgements on this channel.longconsumerCount(String queue) Public API - Returns the number of consumers on a queue.voidexchangeBind(String destination, String source, String routingKey) Public API - Bind an exchange to an exchange, with no extra arguments.Public API - Bind an exchange to an exchange.voidexchangeBindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) Public API - LikeChannel.exchangeBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).exchangeDeclare(String exchange, BuiltinExchangeType type) Public API - Actively declare a non-autodelete, non-durable exchange with no extra argumentsexchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable) Public API - Actively declare a non-autodelete exchange with no extra argumentsexchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) Public API - 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) Public API - Declare an exchange.exchangeDeclare(String exchange, String type) Public API - Actively declare a non-autodelete, non-durable exchange with no extra argumentsexchangeDeclare(String exchange, String type, boolean durable) Public API - Actively declare a non-autodelete exchange with no extra argumentsexchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) Public API - 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) Public API - Declare an exchange.voidexchangeDeclareNoWait(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) LikeChannel.exchangeDeclare(String, String, boolean, boolean, java.util.Map)but sets nowait parameter to true and returns nothing (as there will be no response from the server).voidexchangeDeclareNoWait(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) LikeChannel.exchangeDeclare(String, String, boolean, boolean, java.util.Map)but sets nowait parameter to true and returns nothing (as there will be no response from the server).exchangeDeclarePassive(String exchange) Public API - Declare an exchange passively; that is, check if the named exchange exists.exchangeDelete(String exchange) Public API - Delete an exchange, without regard for whether it is in use or notexchangeDelete(String exchange, boolean ifUnused) Public API - Delete an exchangevoidexchangeDeleteNoWait(String exchange, boolean ifUnused) Public API - LikeChannel.exchangeDelete(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) Public API - Unbind an exchange from an exchange, with no extra arguments.Public API - Unbind an exchange from an exchange.voidexchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) Public API - Same asChannel.exchangeUnbind(String, String, String, java.util.Map)but sets no-wait parameter to true and returns nothing (as there will be no response from the server).Returns the current default consumer.longPublic API - When in confirm mode, returns the sequence number of the next message to be published.protected voidlongmessageCount(String queue) Public API - Returns the number of messages in a queue ready to be delivered to consumers.voidopen()Package method: open the channel.booleanprocessAsync(Command command) Protected API - Filters the inbound command stream, processing Basic.Deliver, Basic.Return and Channel.Close specially.protected voidprocessDelivery(Command command, AMQImpl.Basic.Deliver method) voidprocessShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc) Protected API - overridden to quiesce consumer work and broadcast the signal to all consumers after calling the superclass's method.Public API - Bind a queue to an exchange, with no extra arguments.Public API - Bind a queue to an exchange.voidPublic API - Same asChannel.queueBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).Public API - Actively declare a server-named exclusive, autodelete, non-durable queue.queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) Public API - Declare a queuevoidqueueDeclareNoWait(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) Public API - LikeChannel.queueDeclare(String, boolean, boolean, boolean, java.util.Map)but sets nowait flag to true and returns no result (as there will be no response from the server).queueDeclarePassive(String queue) Public API - Declare a queue passively; i.e., check if it exists.queueDelete(String queue) Public API - Delete a queue, without regard for whether it is in use or has messages on itqueueDelete(String queue, boolean ifUnused, boolean ifEmpty) Public API - Delete a queuevoidqueueDeleteNoWait(String queue, boolean ifUnused, boolean ifEmpty) LikeChannel.queueDelete(String, boolean, boolean)but sets nowait parameter to true and returns nothing (as there will be no response from the server).queuePurge(String queue) Public API - Purges the contents of the given queue.queueUnbind(String queue, String exchange, String routingKey) Public API - Unbinds a queue from an exchange, with no extra arguments.Public API - Unbind a queue from an exchange.booleanremoveConfirmListener(ConfirmListener listener) Remove aConfirmListener.booleanremoveReturnListener(ReturnListener listener) Remove aReturnListener.Protected API - sends aMethodto the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!voidsetDefaultConsumer(Consumer consumer) Sets the current default consumer.txCommit()Public API - Commits a TX transaction on this channel.Public API - Rolls back a TX transaction on this channel.txSelect()Public API - 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 class com.rabbitmq.client.impl.AMQChannel
asyncRpc, connectionInfo, enqueueAsyncRpc, ensureIsOpen, exnWrappingAsyncRpc, exnWrappingRpc, getChannelNumber, getConnection, handleCompleteInboundCommand, handleFrame, isOutstandingRpc, nextOutstandingRpc, notifyOutstandingRpc, quiescingAsyncRpc, quiescingRpc, quiescingTransmit, quiescingTransmit, rpc, rpc, toString, transmit, transmit, wrap, wrap, wrapTimeoutExceptionMethods inherited from class com.rabbitmq.client.impl.ShutdownNotifierComponent
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener, setShutdownCauseIfOpenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.rabbitmq.client.Channel
getChannelNumber, getConnectionMethods inherited from interface com.rabbitmq.client.ShutdownNotifier
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
-
Field Details
-
metricsCollector
-
-
Constructor Details
-
ChannelN
Construct a new channel on the given connection with the given channel number. Usually not called directly - call Connection.createChannel instead.- Parameters:
connection- The connection associated with this channelchannelNumber- The channel number to be associated with this channelworkService- service for managing this channel's consumer callbacks- See Also:
-
ChannelN
public ChannelN(AMQConnection connection, int channelNumber, ConsumerWorkService workService, MetricsCollector metricsCollector, ObservationCollector observationCollector) Construct a new channel on the given connection with the given channel number. Usually not called directly - call Connection.createChannel instead.- Parameters:
connection- The connection associated with this channelchannelNumber- The channel number to be associated with this channelworkService- service for managing this channel's consumer callbacksmetricsCollector- service for managing metrics- See Also:
-
-
Method Details
-
open
Package method: open the channel. This is only called fromChannelManager.- Throws:
IOException- if any problem is encountered
-
addReturnListener
Description copied from interface:ChannelAdd aReturnListener.- Specified by:
addReturnListenerin interfaceChannel- Parameters:
listener- the listener to add
-
addReturnListener
Description copied from interface:ChannelAdd a lambda-basedReturnListener.- Specified by:
addReturnListenerin interfaceChannel- Parameters:
returnCallback- the callback when the message is returned- Returns:
- the listener that wraps the callback
- See Also:
-
removeReturnListener
Description copied from interface:ChannelRemove aReturnListener.- Specified by:
removeReturnListenerin interfaceChannel- Parameters:
listener- the listener to remove- Returns:
trueif the listener was found and removed,falseotherwise
-
clearReturnListeners
public void clearReturnListeners()Description copied from interface:ChannelRemove allReturnListeners.- Specified by:
clearReturnListenersin interfaceChannel
-
addConfirmListener
Description copied from interface:ChannelAdd aConfirmListener.- Specified by:
addConfirmListenerin interfaceChannel- Parameters:
listener- the listener to add
-
addConfirmListener
public ConfirmListener addConfirmListener(ConfirmCallback ackCallback, ConfirmCallback nackCallback) Description copied from interface:ChannelAdd a lambda-basedConfirmListener.- Specified by:
addConfirmListenerin interfaceChannel- Parameters:
ackCallback- callback on acknackCallback- call on nack (negative ack)- Returns:
- the listener that wraps the callbacks
- See Also:
-
removeConfirmListener
Description copied from interface:ChannelRemove aConfirmListener.- Specified by:
removeConfirmListenerin interfaceChannel- Parameters:
listener- the listener to remove- Returns:
trueif the listener was found and removed,falseotherwise
-
clearConfirmListeners
public void clearConfirmListeners()Description copied from interface:ChannelRemove allConfirmListeners.- Specified by:
clearConfirmListenersin interfaceChannel
-
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.- Specified by:
waitForConfirmsin interfaceChannel- Returns:
- whether all the messages were ack'd (and none were nack'd)
- Throws:
InterruptedException
-
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.- Specified by:
waitForConfirmsin interfaceChannel- Returns:
- whether all the messages were ack'd (and none were nack'd)
- Throws:
InterruptedExceptionTimeoutException
-
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.- Specified by:
waitForConfirmsOrDiein interfaceChannel- Throws:
IOExceptionInterruptedException
-
waitForConfirmsOrDie
public void waitForConfirmsOrDie(long timeout) throws IOException, InterruptedException, TimeoutException Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown. If any of the messages were nack'd, waitForConfirmsOrDie will throw an IOException. When called on a non-Confirm channel, it will throw an IllegalStateException.- Specified by:
waitForConfirmsOrDiein interfaceChannel- Throws:
IOExceptionInterruptedExceptionTimeoutException
-
getDefaultConsumer
Returns the current default consumer.- Specified by:
getDefaultConsumerin interfaceChannel- Returns:
- an interface to the current default consumer.
-
setDefaultConsumer
Sets the current default consumer. A null argument is interpreted to mean "do not use a default consumer".- Specified by:
setDefaultConsumerin interfaceChannel- Parameters:
consumer- the consumer to use, or null indicating "don't use one".
-
processShutdownSignal
public void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc) Protected API - overridden to quiesce consumer work and broadcast the signal to all consumers after calling the superclass's method.- Overrides:
processShutdownSignalin classAMQChannel- Parameters:
signal- the signal to handleignoreClosed- the flag indicating whether to ignore the AlreadyClosedException thrown when the channel is already closednotifyRpc- the flag indicating whether any remaining rpc continuation should be notified with the given signal
-
processAsync
Protected API - Filters the inbound command stream, processing Basic.Deliver, Basic.Return and Channel.Close specially. If we're in quiescing mode, all inbound commands are ignored, except for Channel.Close and Channel.CloseOk.- Specified by:
processAsyncin classAMQChannel- Parameters:
command- the command to handle asynchronously- Returns:
- true if we handled the command; otherwise the caller should consider it "unhandled"
- Throws:
IOException
-
processDelivery
-
close
Public API - Close this channel with theAMQP.REPLY_SUCCESSclose code and message 'OK'.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Throws:
IOException- if an error is encounteredTimeoutException
-
close
Public API - Close this channel.- Specified by:
closein interfaceChannel- 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
Public API - 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.- Specified by:
abortin interfaceChannel- Throws:
IOException
-
abort
Public API - Abort this channel. Forces the channel to close and waits for the close operation to complete. Any encountered exceptions in the close operation are silently discarded.- Specified by:
abortin interfaceChannel- Throws:
IOException
-
close
protected void close(int closeCode, String closeMessage, boolean initiatedByApplication, Throwable cause, boolean abort) throws IOException, TimeoutException Protected API - Close channel with code and message, indicating the source of the closure and a causing exception (null if none).- Parameters:
closeCode- the close code (See under "Reply Codes" in the AMQP specification)closeMessage- a message indicating the reason for closing the connectioninitiatedByApplication- true if this comes from an API call, false otherwisecause- exception triggering closeabort- true if we should close and ignore errors- Throws:
IOException- if an error is encounteredTimeoutException
-
basicQos
Public API - Request specific "quality of service" settings.These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.
Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).
- Specified by:
basicQosin interfaceChannel- 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
Public API - Request a specific prefetchCount "quality of service" settings for this channel.Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).
- Specified by:
basicQosin interfaceChannel- 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
Public API - Request a specific prefetchCount "quality of service" settings for this channel.Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1).
- Specified by:
basicQosin interfaceChannel- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimited- Throws:
IOException- if an error is encountered- See Also:
-
basicPublish
public void basicPublish(String exchange, String routingKey, AMQP.BasicProperties props, byte[] body) throws IOException Public API - 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.- Specified by:
basicPublishin interfaceChannel- 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
public void basicPublish(String exchange, String routingKey, boolean mandatory, AMQP.BasicProperties props, byte[] body) throws IOException Public API - Publish a message. Invocations ofChannel#basicPublishwill eventually block if a resource-driven alarm is in effect.- Specified by:
basicPublishin interfaceChannel- 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
public void basicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, AMQP.BasicProperties props, byte[] body) throws IOException Public API - 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.- Specified by:
basicPublishin interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionPublic API - Declare an exchange.- Specified by:
exchangeDeclarein interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionPublic API - Declare an exchange.- Specified by:
exchangeDeclarein interfaceChannel- 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:
-
exchangeDeclareNoWait
public void exchangeDeclareNoWait(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionDescription copied from interface:ChannelLikeChannel.exchangeDeclare(String, String, boolean, boolean, java.util.Map)but sets nowait parameter to true and returns nothing (as there will be no response from the server).- Specified by:
exchangeDeclareNoWaitin interfaceChannel- 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
public void exchangeDeclareNoWait(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionDescription copied from interface:ChannelLikeChannel.exchangeDeclare(String, String, boolean, boolean, java.util.Map)but sets nowait parameter to true and returns nothing (as there will be no response from the server).- Specified by:
exchangeDeclareNoWaitin interfaceChannel- 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
-
exchangeDeclare
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionPublic API - Declare an exchange, via an interface that allows the complete set of arguments.- Specified by:
exchangeDeclarein interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOExceptionPublic API - Declare an exchange, via an interface that allows the complete set of arguments.- Specified by:
exchangeDeclarein interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable) throws IOException Public API - Actively declare a non-autodelete exchange with no extra arguments- Specified by:
exchangeDeclarein interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable) throws IOException Public API - Actively declare a non-autodelete exchange with no extra arguments- Specified by:
exchangeDeclarein interfaceChannel- 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
Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments- Specified by:
exchangeDeclarein interfaceChannel- 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
public AMQImpl.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type) throws IOException Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments- Specified by:
exchangeDeclarein interfaceChannel- 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:
-
exchangeDeclarePassive
Public API - Declare an exchange passively; that is, check if the named exchange exists.- Specified by:
exchangeDeclarePassivein interfaceChannel- Parameters:
exchange- 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
public AMQImpl.Exchange.DeleteOk exchangeDelete(String exchange, boolean ifUnused) throws IOException Public API - Delete an exchange- Specified by:
exchangeDeletein interfaceChannel- 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
Public API - LikeChannel.exchangeDelete(String, boolean)but sets nowait parameter to true and returns void (as there will be no response from the server).- Specified by:
exchangeDeleteNoWaitin interfaceChannel- 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
Public API - Delete an exchange, without regard for whether it is in use or not- Specified by:
exchangeDeletein interfaceChannel- 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
public AMQImpl.Exchange.BindOk exchangeBind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Bind an exchange to an exchange.- Specified by:
exchangeBindin interfaceChannel- 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
public void exchangeBindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - LikeChannel.exchangeBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).- Specified by:
exchangeBindNoWaitin interfaceChannel- 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
-
exchangeBind
public AMQImpl.Exchange.BindOk exchangeBind(String destination, String source, String routingKey) throws IOException Public API - Bind an exchange to an exchange, with no extra arguments.- Specified by:
exchangeBindin interfaceChannel- 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
public AMQImpl.Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Unbind an exchange from an exchange.- Specified by:
exchangeUnbindin interfaceChannel- 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:
-
exchangeUnbind
public AMQImpl.Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey) throws IOException Public API - Unbind an exchange from an exchange, with no extra arguments.- Specified by:
exchangeUnbindin interfaceChannel- 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:
-
exchangeUnbindNoWait
public void exchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Same asChannel.exchangeUnbind(String, String, String, java.util.Map)but sets no-wait parameter to true and returns nothing (as there will be no response from the server).- Specified by:
exchangeUnbindNoWaitin interfaceChannel- 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
public AMQImpl.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionPublic API - Declare a queue- Specified by:
queueDeclarein interfaceChannel- 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:
-
queueDeclare
Public API - 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.- Specified by:
queueDeclarein interfaceChannel- Returns:
- a declaration-confirm method to indicate the queue was successfully declared
- Throws:
IOException- if an error is encountered- See Also:
-
queueDeclareNoWait
public void queueDeclareNoWait(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOExceptionPublic API - LikeChannel.queueDeclare(String, boolean, boolean, boolean, java.util.Map)but sets nowait flag to true and returns no result (as there will be no response from the server).- Specified by:
queueDeclareNoWaitin interfaceChannel- 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
Public API - Declare a queue passively; i.e., check if it exists. In AMQP 0-9-1, all arguments aside from nowait are ignored; and sending nowait makes this method a no-op, so we default it to false.- Specified by:
queueDeclarePassivein interfaceChannel- 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:
-
messageCount
Public API - Returns the number of messages in a queue ready to be delivered to consumers. This method assumes the queue exists. If it doesn't, the channels will be closed with an exception.- Specified by:
messageCountin interfaceChannel- Parameters:
queue- the name of the queue- Returns:
- the number of messages in ready state
- Throws:
IOException- Problem transmitting method.
-
consumerCount
Public API - Returns the number of consumers on a queue. This method assumes the queue exists. If it doesn't, the channel will be closed with an exception.- Specified by:
consumerCountin interfaceChannel- Parameters:
queue- the name of the queue- Returns:
- the number of consumers
- Throws:
IOException- Problem transmitting method.
-
queueDelete
public AMQImpl.Queue.DeleteOk queueDelete(String queue, boolean ifUnused, boolean ifEmpty) throws IOException Public API - Delete a queue- Specified by:
queueDeletein interfaceChannel- 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
Description copied from interface:ChannelLikeChannel.queueDelete(String, boolean, boolean)but sets nowait parameter to true and returns nothing (as there will be no response from the server).- Specified by:
queueDeleteNoWaitin interfaceChannel- 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:
-
queueDelete
Public API - Delete a queue, without regard for whether it is in use or has messages on it- Specified by:
queueDeletein interfaceChannel- 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:
-
queueBind
public AMQImpl.Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Bind a queue to an exchange.- Specified by:
queueBindin interfaceChannel- 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:
-
queueBind
public AMQImpl.Queue.BindOk queueBind(String queue, String exchange, String routingKey) throws IOException Public API - Bind a queue to an exchange, with no extra arguments.- Specified by:
queueBindin interfaceChannel- 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:
-
queueBindNoWait
public void queueBindNoWait(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Same asChannel.queueBind(String, String, String, java.util.Map)but sets nowait parameter to true and returns void (as there will be no response from the server).- Specified by:
queueBindNoWaitin interfaceChannel- 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
public AMQImpl.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOExceptionPublic API - Unbind a queue from an exchange.- Specified by:
queueUnbindin interfaceChannel- 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
Public API - Purges the contents of the given queue.- Specified by:
queuePurgein interfaceChannel- 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:
-
queueUnbind
public AMQImpl.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey) throws IOException Public API - Unbinds a queue from an exchange, with no extra arguments.- Specified by:
queueUnbindin interfaceChannel- 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:
-
basicGet
Public API - Retrieve a message from a queue usingAMQP.Basic.Get- Specified by:
basicGetin interfaceChannel- 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
Public API - Acknowledge one or several received messages. Supply the deliveryTag from theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the received message being acknowledged.- Specified by:
basicAckin interfaceChannel- 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
Public API - Reject one or several received messages. Supply thedeliveryTagfrom theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the message to be rejected.- Specified by:
basicNackin interfaceChannel- 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
Public API - Reject a message. Supply the deliveryTag from theAMQP.Basic.GetOkorAMQP.Basic.Delivermethod containing the received message being rejected.- Specified by:
basicRejectin interfaceChannel- 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
Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.- Specified by:
basicConsumein interfaceChannel- 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
public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.- Specified by:
basicConsumein interfaceChannel- 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
public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Description copied from interface:ChannelStart 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, Consumer callback) throws IOExceptionPublic API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag and specified arguments.- Specified by:
basicConsumein interfaceChannel- 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
public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOExceptionPublic API - Start 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionPublic API - Start 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionPublic API - Start 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) throws IOException Public API - Start a non-nolocal, non-exclusive consumer.- Specified by:
basicConsumein interfaceChannel- 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
public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException Public API - 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOExceptionPublic API - Start 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionPublic API - Start 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOExceptionDescription copied from interface:ChannelStart 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.- Specified by:
basicConsumein interfaceChannel- 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- See Also:
-
basicConsume
public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOExceptionPublic API - Start a consumer. Calls the consumer'sConsumer.handleConsumeOk(java.lang.String)method.- Specified by:
basicConsumein interfaceChannel- 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:
-
basicCancel
Public API - Cancel a consumer. Calls the consumer'sConsumer.handleCancelOk(java.lang.String)method.- Specified by:
basicCancelin interfaceChannel- 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
Public API -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.- Specified by:
basicRecoverin interfaceChannel- Throws:
IOException- See Also:
-
basicRecover
Public API - Ask the broker to resend unacknowledged messages. In 0-8 basic.recover is asynchronous; in 0-9-1 it is synchronous, and the new, deprecated method basic.recover_async is asynchronous.- Specified by:
basicRecoverin interfaceChannel- 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
Public API - Enables TX mode on this channel.- Specified by:
txSelectin interfaceChannel- Returns:
- a transaction-selection method to indicate the transaction was successfully initiated
- Throws:
IOException- if an error is encountered- See Also:
-
txCommit
Public API - Commits a TX transaction on this channel.- Specified by:
txCommitin interfaceChannel- Returns:
- a transaction-commit method to indicate the transaction was successfully committed
- Throws:
IOException- if an error is encountered- See Also:
-
txRollback
Public API - Rolls back a TX transaction on this channel.- Specified by:
txRollbackin interfaceChannel- Returns:
- a transaction-rollback method to indicate the transaction was successfully rolled back
- Throws:
IOException- if an error is encountered- See Also:
-
confirmSelect
Public API - Enables publisher acknowledgements on this channel.- Specified by:
confirmSelectin interfaceChannel- Throws:
IOException- if an error is encountered- See Also:
-
getNextPublishSeqNo
public long getNextPublishSeqNo()Public API - When in confirm mode, returns the sequence number of the next message to be published.- Specified by:
getNextPublishSeqNoin interfaceChannel- Returns:
- the sequence number of the next message to be published
-
asyncRpc
Description copied from interface:ChannelAsynchronously send a method over this channel.- Specified by:
asyncRpcin interfaceChannel- Parameters:
method- method to transmit over this channel.- Throws:
IOException- Problem transmitting method.
-
rpc
Description copied from class:AMQChannelProtected API - sends aMethodto the broker and waits for the next in-bound Command from the broker: only for use from non-connection-MainLoop threads!- Specified by:
rpcin interfaceChannel- Overrides:
rpcin classAMQChannel- Parameters:
method- method to transmit over this channel.- Returns:
- command response to method. Caller should cast as appropriate.
- Throws:
IOException- Problem transmitting method.
-
asyncCompletableRpc
Description copied from interface:ChannelAsynchronously send a method over this channel.- Specified by:
asyncCompletableRpcin interfaceChannel- Parameters:
method- method to transmit over this channel.- Returns:
- a completable future that completes when the result is received
- Throws:
IOException- Problem transmitting method.
-
enqueueRpc
- Overrides:
enqueueRpcin classAMQChannel
-
markRpcFinished
protected void markRpcFinished()- Overrides:
markRpcFinishedin classAMQChannel
-