java.lang.Object | |||
↳ | com.rabbitmq.client.impl.ShutdownNotifierComponent | ||
↳ | com.rabbitmq.client.impl.AMQChannel | ||
↳ | com.rabbitmq.client.impl.ChannelN |
Main interface to AMQP protocol functionality. Public API - Implementation of all AMQChannels except channel zero.
To open a channel,
Connection
conn = ...;ChannelN
ch1 = conn.createChannel
();
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.rabbitmq.client.impl.AMQChannel
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a new channel on the given connection with the given
channel number.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public API - Abort this channel.
| |||||||||||
Public API - Abort this channel with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
Add a
ConfirmListener . | |||||||||||
Add a
FlowListener . | |||||||||||
Add a
ReturnListener . | |||||||||||
Asynchronously send a method over this channel.
| |||||||||||
Public API - Acknowledge one or several received
messages.
| |||||||||||
Public API - Cancel a consumer.
| |||||||||||
Public API - Start a non-nolocal, non-exclusive consumer.
| |||||||||||
Public API - Start a consumer.
| |||||||||||
Public API - Start a non-nolocal, non-exclusive consumer, with
a server-generated consumerTag.
| |||||||||||
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 using com.rabbitmq.client.AMQP.Basic.Get
| |||||||||||
Public API - Reject one or several received messages.
| |||||||||||
Public API -
| |||||||||||
Public API -
| |||||||||||
Public API - Request a specific prefetchCount "quality of service" settings
for this channel.
| |||||||||||
Public API - Request specific "quality of service" settings.
| |||||||||||
Public API - Ask the broker to resend unacknowledged messages.
| |||||||||||
Public API - Ask the broker to resend unacknowledged messages.
| |||||||||||
Public API - Ask the broker to resend unacknowledged messages.
| |||||||||||
Public API - Reject a message.
| |||||||||||
Remove all
ConfirmListener s. | |||||||||||
Remove all
FlowListener s. | |||||||||||
Remove all
ReturnListener s. | |||||||||||
Public API - Close this channel.
| |||||||||||
Public API - Close this channel with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
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.
| |||||||||||
Public API - Bind an exchange to an exchange, with no extra arguments.
| |||||||||||
Public API - Bind an exchange to an exchange.
| |||||||||||
Public API - Actively declare a non-autodelete exchange with no extra arguments
| |||||||||||
Public API - Declare an exchange.
| |||||||||||
Public API - Declare an exchange, via an interface that allows the complete set of
arguments.
| |||||||||||
Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments
| |||||||||||
Public API - Declare an exchange passively; that is, check if the named exchange exists.
| |||||||||||
Public API - Delete an exchange
| |||||||||||
Public API - Delete an exchange, without regard for whether it is in use or not
| |||||||||||
Public API - Unbind an exchange from an exchange, with no extra arguments.
| |||||||||||
Public API - Unbind an exchange from an exchange.
| |||||||||||
Public API - Set flow on the channel
| |||||||||||
Returns the current default consumer.
| |||||||||||
Public API - Return the current Channel.Flow settings.
| |||||||||||
Public API - When in confirm mode, returns the sequence number of the next
message to be published.
| |||||||||||
Package method: open the channel.
| |||||||||||
Protected API - Filters the inbound command stream, processing
Basic.Deliver, Basic.Return and Channel.Close specially.
| |||||||||||
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.
| |||||||||||
Public API - Bind a queue to an exchange, with no extra arguments.
| |||||||||||
Public API - Declare a queue
| |||||||||||
Public API - Actively declare a server-named exclusive, autodelete, non-durable queue.
| |||||||||||
Public API - Declare a queue passively; i.e., check if it exists.
| |||||||||||
Public API - Delete a queue, without regard for whether it is in use or has messages on it
| |||||||||||
Public API - Delete a queue
| |||||||||||
Public API - Purges the contents of the given queue.
| |||||||||||
Public API - Unbind a queue from an exchange.
| |||||||||||
Public API - Unbinds a queue from an exchange, with no extra arguments.
| |||||||||||
Remove a
ConfirmListener . | |||||||||||
Remove a
FlowListener . | |||||||||||
Remove a
ReturnListener . | |||||||||||
Protected API - sends a
Method to the broker and waits for the
next in-bound Command from the broker: only for use from
non-connection-MainLoop threads!
| |||||||||||
Sets the current default consumer.
| |||||||||||
Public API - Commits a TX transaction on this channel.
| |||||||||||
Public API - Rolls back a TX transaction on this channel.
| |||||||||||
Public API - Enables TX mode on this channel.
| |||||||||||
Wait until all messages published since the last call have been
either ack'd or nack'd by the broker.
| |||||||||||
Wait until all messages published since the last call have
been either ack'd or nack'd by the broker.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.rabbitmq.client.impl.AMQChannel
| |||||||||||
From class
com.rabbitmq.client.impl.ShutdownNotifierComponent
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.rabbitmq.client.Channel
| |||||||||||
From interface
com.rabbitmq.client.ShutdownNotifier
|
Construct a new channel on the given connection with the given channel number. Usually not called directly - call Connection.createChannel instead.
connection | The connection associated with this channel |
---|---|
channelNumber | The channel number to be associated with this channel |
workService | service for managing this channel's consumer callbacks |
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.
IOException |
---|
Public API - Abort this channel with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
Forces the channel to close and waits for the close operation to complete.
Any encountered exceptions in the close operation are silently discarded.
IOException |
---|
Add a ConfirmListener
.
listener | the listener to add |
---|
Add a FlowListener
.
listener | the listener to add |
---|
Add a ReturnListener
.
listener | the listener to add |
---|
Asynchronously send a method over this channel.
method | method to transmit over this channel. |
---|
IOException |
---|
Public API - Acknowledge one or several received messages. Supply the deliveryTag from the com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver method containing the received message being acknowledged.
deliveryTag | the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver |
---|---|
multiple | true to acknowledge all messages up to and including the supplied delivery tag; false to acknowledge just the supplied delivery tag. |
IOException |
---|
Public API - Cancel a consumer. Calls the consumer's handleCancelOk(String)
method.
consumerTag | a client- or server-generated consumer tag to establish context |
---|
IOException |
---|
Public API - Start a non-nolocal, non-exclusive consumer.
queue | the name of the queue |
---|---|
autoAck | true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements |
consumerTag | a client-generated consumer tag to establish context |
callback | an interface to the consumer object |
IOException |
---|
Public API - Start a consumer. Calls the consumer's handleConsumeOk(String)
method.
queue | the name of the queue |
---|---|
autoAck | true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements |
consumerTag | a client-generated consumer tag to establish context |
noLocal | flag set to true unless server local buffering is required |
exclusive | true if this is an exclusive consumer |
arguments | a set of arguments for the consume |
callback | an interface to the consumer object |
IOException |
---|
Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.
queue | the name of the queue |
---|---|
autoAck | true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements |
callback | an interface to the consumer object |
IOException |
---|
Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgement and a server-generated consumerTag.
queue | the name of the queue |
---|---|
callback | an interface to the consumer object |
IOException |
---|
Public API - Retrieve a message from a queue using com.rabbitmq.client.AMQP.Basic.Get
queue | the name of the queue |
---|---|
autoAck | true if the server should consider messages acknowledged once delivered; false if the server should expect explicit acknowledgements |
GetResponse
containing the retrieved message dataIOException |
---|
Public API - Reject one or several received messages.
Supply the deliveryTag
from the com.rabbitmq.client.AMQP.Basic.GetOk
or com.rabbitmq.client.AMQP.Basic.GetOk method containing the message to be rejected.
deliveryTag | the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver |
---|---|
multiple | true to reject all messages up to and including the supplied delivery tag; false to reject just the supplied delivery tag. |
requeue | true if the rejected message(s) should be requeued rather than discarded/dead-lettered |
IOException |
---|
Public API -
IOException |
---|
Public API -
IOException |
---|
Public API - Request a specific prefetchCount "quality of service" settings for this channel.
prefetchCount | maximum number of messages that the server will deliver, 0 if unlimited |
---|
IOException |
---|
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.
prefetchSize | maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited |
---|---|
prefetchCount | maximum number of messages that the server will deliver, 0 if unlimited |
global | true if the settings should be applied to the entire connection rather than just the current channel |
IOException |
---|
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. IOException |
---|
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.
requeue | If true, messages will be requeued and possibly delivered to a different consumer. If false, messages will be redelivered to the same consumer. |
---|
IOException |
---|
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 and deprecated.
requeue | If true, messages will be requeued and possibly delivered to a different consumer. If false, messages will be redelivered to the same consumer. |
---|
IOException |
---|
Public API - Reject a message. Supply the deliveryTag from the com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver method containing the received message being rejected.
deliveryTag | the tag from the received com.rabbitmq.client.AMQP.Basic.GetOk or com.rabbitmq.client.AMQP.Basic.Deliver |
---|---|
requeue | true if the rejected message should be requeued rather than discarded/dead-lettered |
IOException |
---|
Public API - Close this channel.
closeCode | the close code (See under "Reply Codes" in the AMQP specification) |
---|---|
closeMessage | a message indicating the reason for closing the connection |
IOException |
---|
Public API - Close this channel with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
IOException |
---|
Protected API - Close channel with code and message, indicating the source of the closure and a causing exception (null if none).
IOException |
---|
Public API - Enables publisher acknowledgements on this channel.
IOException |
---|
Public API - Bind an exchange to an exchange, with no extra arguments.
IOException |
---|
Public API - Bind an exchange to an exchange.
IOException |
---|
Public API - Actively declare a non-autodelete exchange with no extra arguments
exchange | the name of the exchange |
---|---|
type | the exchange type |
durable | true if we are declaring a durable exchange (the exchange will survive a server restart) |
IOException |
---|
Public API - Declare an exchange.
exchange | the name of the exchange |
---|---|
type | the exchange type |
durable | true if we are declaring a durable exchange (the exchange will survive a server restart) |
autoDelete | true if the server should delete the exchange when it is no longer in use |
arguments | other properties (construction arguments) for the exchange |
IOException |
---|
Public API - Declare an exchange, via an interface that allows the complete set of arguments.
exchange | the name of the exchange |
---|---|
type | the exchange type |
durable | true if we are declaring a durable exchange (the exchange will survive a server restart) |
autoDelete | true if the server should delete the exchange when it is no longer in use |
internal | true if the exchange is internal, i.e. can't be directly published to by a client. |
arguments | other properties (construction arguments) for the exchange |
IOException |
---|
Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments
exchange | the name of the exchange |
---|---|
type | the exchange type |
IOException |
---|
Public API - Declare an exchange passively; that is, check if the named exchange exists.
exchange | check the existence of an exchange named this |
---|
IOException |
---|
Public API - Delete an exchange
exchange | the name of the exchange |
---|---|
ifUnused | true to indicate that the exchange is only to be deleted if it is unused |
IOException |
---|
Public API - Delete an exchange, without regard for whether it is in use or not
exchange | the name of the exchange |
---|
IOException |
---|
Public API - Unbind an exchange from an exchange, with no extra arguments.
IOException |
---|
Public API - Unbind an exchange from an exchange.
IOException |
---|
Public API - Set flow on the channel
a | if true, the server is asked to start sending. If false, the server is asked to stop sending. |
---|
IOException |
---|
Returns the current default consumer.
Public API - Return the current Channel.Flow settings.
Public API - When in confirm mode, returns the sequence number of the next message to be published.
Package method: open the channel.
This is only called from ChannelManager
.
IOException | if any problem is encountered |
---|
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.
command | the command to handle asynchronously |
---|
IOException |
---|
Protected API - overridden to quiesce consumer work and broadcast the signal to all consumers after calling the superclass's method.
signal | the signal to handle |
---|---|
ignoreClosed | the flag indicating whether to ignore the AlreadyClosedException thrown when the channel is already closed |
notifyRpc | the flag indicating whether any remaining rpc continuation should be notified with the given signal |
Public API - Bind a queue to an exchange.
queue | the name of the queue |
---|---|
exchange | the name of the exchange |
routingKey | the routine key to use for the binding |
arguments | other properties (binding parameters) |
IOException |
---|
Public API - Bind a queue to an exchange, with no extra arguments.
queue | the name of the queue |
---|---|
exchange | the name of the exchange |
routingKey | the routine key to use for the binding |
IOException |
---|
Public API - Declare a queue
queue | the name of the queue |
---|---|
durable | true if we are declaring a durable queue (the queue will survive a server restart) |
exclusive | true if we are declaring an exclusive queue (restricted to this connection) |
autoDelete | true if we are declaring an autodelete queue (server will delete it when no longer in use) |
arguments | other properties (construction arguments) for the queue |
IOException |
---|
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 the com.rabbitmq.client.AMQP.Queue.DeclareOk result.
IOException |
---|
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.
queue | the name of the queue |
---|
IOException |
---|
Public API - Delete a queue, without regard for whether it is in use or has messages on it
queue | the name of the queue |
---|
IOException |
---|
Public API - Delete a queue
queue | the name of the queue |
---|---|
ifUnused | true if the queue should be deleted only if not in use |
ifEmpty | true if the queue should be deleted only if empty |
IOException |
---|
Public API - Purges the contents of the given queue.
queue | the name of the queue |
---|
IOException |
---|
Public API - Unbind a queue from an exchange.
queue | the name of the queue |
---|---|
exchange | the name of the exchange |
routingKey | the routine key to use for the binding |
arguments | other properties (binding parameters) |
IOException |
---|
Public API - Unbinds a queue from an exchange, with no extra arguments.
queue | the name of the queue |
---|---|
exchange | the name of the exchange |
routingKey | the routine key to use for the binding |
IOException |
---|
Remove a ConfirmListener
.
listener | the listener to remove |
---|
true
if the listener was found and removed,
false
otherwise
Remove a FlowListener
.
listener | the listener to remove |
---|
true
if the listener was found and removed,
false
otherwise
Remove a ReturnListener
.
listener | the listener to remove |
---|
true
if the listener was found and removed,
false
otherwise
Protected API - sends a Method
to the broker and waits for the
next in-bound Command from the broker: only for use from
non-connection-MainLoop threads!
IOException |
---|
Sets the current default consumer. A null argument is interpreted to mean "do not use a default consumer".
consumer | the consumer to use, or null indicating "don't use one". |
---|
Public API - Commits a TX transaction on this channel.
IOException |
---|
Public API - Rolls back a TX transaction on this channel.
IOException |
---|
Public API - Enables TX mode on this channel.
IOException |
---|
Wait until all messages published since the last call have been either ack'd or nack'd by the broker. Note, when called on a non-Confirm channel, waitForConfirms returns true immediately.
InterruptedException |
---|
Wait until all messages published since the last call have been either ack'd or nack'd by the broker. If any of the messages were nack'd, waitForConfirmsOrDie will throw an IOException. When called on a non-Confirm channel, it will return immediately.
IOException | |
---|---|
InterruptedException |