com.rabbitmq.client.impl
Class ChannelN

java.lang.Object
  extended by com.rabbitmq.client.impl.ShutdownNotifierComponent
      extended by com.rabbitmq.client.impl.AMQChannel
          extended by com.rabbitmq.client.impl.ChannelN
All Implemented Interfaces:
Channel, ShutdownNotifier

public class ChannelN
extends AMQChannel
implements Channel

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();
 ch1.open();
 


Nested Class Summary
 
Nested classes/interfaces inherited from class com.rabbitmq.client.impl.AMQChannel
AMQChannel.BlockingRpcContinuation<T>, AMQChannel.RpcContinuation, AMQChannel.SimpleBlockingRpcContinuation
 
Field Summary
 java.util.Map<java.lang.String,Consumer> _consumers
          Map from consumer tag to Consumer instance.
 Consumer defaultConsumer
          Reference to the currently-active default consumer, or null if there is none.
 FlowListener flowListener
          Reference to the currently-active FlowListener, or null if there is none.
 ReturnListener returnListener
          Reference to the currently-active ReturnListener, or null if there is none.
 
Fields inherited from class com.rabbitmq.client.impl.AMQChannel
_activeRpc, _blockContent, _channelMutex, _channelNumber, _commandAssembler, _connection
 
Fields inherited from class com.rabbitmq.client.impl.ShutdownNotifierComponent
_shutdownCause, listeners
 
Constructor Summary
ChannelN(AMQConnection connection, int channelNumber)
          Construct a new channel on the given connection with the given channel number.
 
Method Summary
 void abort()
          Public API - Abort this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'.
 void abort(int closeCode, java.lang.String closeMessage)
          Public API - Abort this channel.
 void basicAck(long deliveryTag, boolean multiple)
          Public API - Acknowledge one or several received messages.
 void basicCancel(java.lang.String consumerTag)
          Public API - Cancel a consumer.
 java.lang.String basicConsume(java.lang.String queue, boolean noAck, Consumer callback)
          Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.
 java.lang.String basicConsume(java.lang.String queue, boolean noAck, java.lang.String consumerTag, boolean noLocal, boolean exclusive, java.util.Map<java.lang.String,java.lang.Object> arguments, Consumer callback)
          Public API - Start a consumer.
 java.lang.String basicConsume(java.lang.String queue, boolean noAck, java.lang.String consumerTag, Consumer callback)
          Public API - Start a non-nolocal, non-exclusive consumer.
 java.lang.String basicConsume(java.lang.String queue, Consumer callback)
          Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgements required and a server-generated consumerTag.
 GetResponse basicGet(java.lang.String queue, boolean noAck)
          Public API - Retrieve a message from a queue using AMQP.Basic.Get
 void basicPublish(java.lang.String exchange, java.lang.String routingKey, AMQP.BasicProperties props, byte[] body)
          Public API - Publish a message with both "mandatory" and "immediate" flags set to false
 void basicPublish(java.lang.String exchange, java.lang.String routingKey, boolean mandatory, boolean immediate, AMQP.BasicProperties props, byte[] body)
          Public API - Publish a message
 void basicQos(int prefetchCount)
          Public API - Request a specific prefetchCount "quality of service" settings for this channel.
 void basicQos(int prefetchSize, int prefetchCount, boolean global)
          Public API - Request specific "quality of service" settings.
 AMQImpl.Basic.RecoverOk basicRecover(boolean requeue)
          Public API - Ask the broker to resend unacknowledged messages.
 void basicRecoverAsync(boolean requeue)
          Public API - Ask the broker to resend unacknowledged messages.
 void basicReject(long deliveryTag, boolean requeue)
          Public API - Reject a message.
 void broadcastShutdownSignal(ShutdownSignalException signal)
          Protected API - sends a ShutdownSignal to all active consumers.
 void close()
          Public API - Close this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'.
 void close(int closeCode, java.lang.String closeMessage)
          Public API - Close this channel.
 void close(int closeCode, java.lang.String closeMessage, boolean initiatedByApplication, java.lang.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).
 AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange, java.lang.String type)
          Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments
 AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange, java.lang.String type, boolean durable)
          Public API - Actively declare a non-autodelete exchange with no extra arguments
 AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange, java.lang.String type, boolean durable, boolean autoDelete, java.util.Map<java.lang.String,java.lang.Object> arguments)
          Public API - Declare an exchange, via an interface that allows the complete set of arguments.
 AMQImpl.Exchange.DeclareOk exchangeDeclarePassive(java.lang.String exchange)
          Public API - Declare an exchange passively; that is, check if the named exchange exists.
 AMQImpl.Exchange.DeleteOk exchangeDelete(java.lang.String exchange)
          Public API - Delete an exchange, without regard for whether it is in use or not
 AMQImpl.Exchange.DeleteOk exchangeDelete(java.lang.String exchange, boolean ifUnused)
          Public API - Delete an exchange
 AMQImpl.Channel.FlowOk flow(boolean a)
          Public API - Set flow on the channel
 Consumer getDefaultConsumer()
          Returns the current default consumer.
 AMQImpl.Channel.FlowOk getFlow()
          Public API - Return the current Channel.Flow settings.
 FlowListener getFlowListener()
          Returns the current FlowListener.
 ReturnListener getReturnListener()
          Returns the current ReturnListener.
 void open()
          Package method: open the channel.
 boolean processAsync(Command command)
          Protected API - Filters the inbound command stream, processing Basic.Deliver, Basic.Return and Channel.Close specially.
 void processShutdownSignal(ShutdownSignalException signal, boolean ignoreClosed, boolean notifyRpc)
          Protected API - overridden to broadcast the signal to all consumers before calling the superclass's method.
 AMQImpl.Queue.BindOk queueBind(java.lang.String queue, java.lang.String exchange, java.lang.String routingKey)
          Public API - Bind a queue to an exchange, with no extra arguments.
 AMQImpl.Queue.BindOk queueBind(java.lang.String queue, java.lang.String exchange, java.lang.String routingKey, java.util.Map<java.lang.String,java.lang.Object> arguments)
          Public API - Bind a queue to an exchange.
 AMQP.Queue.DeclareOk queueDeclare()
          Public API - Actively declare a server-named exclusive, autodelete, non-durable queue.
 AMQImpl.Queue.DeclareOk queueDeclare(java.lang.String queue, boolean durable, boolean exclusive, boolean autoDelete, java.util.Map<java.lang.String,java.lang.Object> arguments)
          Public API - Declare a queue
 AMQImpl.Queue.DeclareOk queueDeclarePassive(java.lang.String queue)
          Public API - Declare a queue passively; i.e., check if it exists.
 AMQImpl.Queue.DeleteOk queueDelete(java.lang.String queue)
          Public API - Delete a queue, without regard for whether it is in use or has messages on it
 AMQImpl.Queue.DeleteOk queueDelete(java.lang.String queue, boolean ifUnused, boolean ifEmpty)
          Public API - Delete a queue
 AMQImpl.Queue.PurgeOk queuePurge(java.lang.String queue)
          Public API - Purges the contents of the given queue.
 AMQImpl.Queue.UnbindOk queueUnbind(java.lang.String queue, java.lang.String exchange, java.lang.String routingKey)
          Public API - Unbinds a queue from an exchange, with no extra arguments.
 AMQImpl.Queue.UnbindOk queueUnbind(java.lang.String queue, java.lang.String exchange, java.lang.String routingKey, java.util.Map<java.lang.String,java.lang.Object> arguments)
          Public API - Unbind a queue from an exchange.
 void releaseChannelNumber()
           
 void setDefaultConsumer(Consumer consumer)
          Sets the current default consumer.
 void setFlowListener(FlowListener listener)
          Sets the current FlowListener.
 void setReturnListener(ReturnListener listener)
          Sets the current ReturnListener.
 AMQImpl.Tx.CommitOk txCommit()
          Public API - Commits a TX transaction on this channel.
 AMQImpl.Tx.RollbackOk txRollback()
          Public API - Rolls back a TX transaction on this channel.
 AMQImpl.Tx.SelectOk txSelect()
          Public API - Enables TX mode on this channel.
 
Methods inherited from class com.rabbitmq.client.impl.AMQChannel
enqueueRpc, ensureIsOpen, exnWrappingRpc, getAMQConnection, getChannelNumber, getConnection, handleCompleteInboundCommand, handleFrame, nextOutstandingRpc, notifyOutstandingRpc, quiescingRpc, quiescingTransmit, quiescingTransmit, rpc, rpc, toString, transmit, transmit, wrap, wrap
 
Methods inherited from class com.rabbitmq.client.impl.ShutdownNotifierComponent
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rabbitmq.client.Channel
getChannelNumber, getConnection
 
Methods inherited from interface com.rabbitmq.client.ShutdownNotifier
addShutdownListener, getCloseReason, isOpen, notifyListeners, removeShutdownListener
 

Field Detail

_consumers

public final java.util.Map<java.lang.String,Consumer> _consumers
Map from consumer tag to Consumer instance. Note that, in general, this map should ONLY ever be accessed from the connection's reader thread. We go to some pains to ensure this is the case - see the use of BlockingRpcContinuation to inject code into the reader thread in basicConsume and basicCancel.


returnListener

public volatile ReturnListener returnListener
Reference to the currently-active ReturnListener, or null if there is none.


flowListener

public volatile FlowListener flowListener
Reference to the currently-active FlowListener, or null if there is none.


defaultConsumer

public volatile Consumer defaultConsumer
Reference to the currently-active default consumer, or null if there is none.

Constructor Detail

ChannelN

public ChannelN(AMQConnection connection,
                int channelNumber)
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 channel
channelNumber - The channel number to be associated with this channel
See Also:
Connection.createChannel()
Method Detail

open

public void open()
          throws java.io.IOException
Package method: open the channel. This is only called from AMQConnection.

Throws:
java.io.IOException - if any problem is encountered

getReturnListener

public ReturnListener getReturnListener()
Returns the current ReturnListener.

Specified by:
getReturnListener in interface Channel
Returns:
an interface to the current return listener

setReturnListener

public void setReturnListener(ReturnListener listener)
Sets the current ReturnListener. A null argument is interpreted to mean "do not use a return listener".

Specified by:
setReturnListener in interface Channel
Parameters:
listener - the listener to use, or null indicating "don't use one".

getFlowListener

public FlowListener getFlowListener()
Returns the current FlowListener.

Specified by:
getFlowListener in interface Channel
Returns:
an interface to the current flow listener.

setFlowListener

public void setFlowListener(FlowListener listener)
Sets the current FlowListener. A null argument is interpreted to mean "do not use a flow listener".

Specified by:
setFlowListener in interface Channel
Parameters:
listener - the listener to use, or null indicating "don't use one".

getDefaultConsumer

public Consumer getDefaultConsumer()
Returns the current default consumer.

Specified by:
getDefaultConsumer in interface Channel
Returns:
an interface to the current default consumer.

setDefaultConsumer

public void setDefaultConsumer(Consumer consumer)
Sets the current default consumer. A null argument is interpreted to mean "do not use a default consumer".

Specified by:
setDefaultConsumer in interface Channel
Parameters:
consumer - the consumer to use, or null indicating "don't use one".

broadcastShutdownSignal

public void broadcastShutdownSignal(ShutdownSignalException signal)
Protected API - sends a ShutdownSignal to all active consumers.

Parameters:
signal - an exception signalling channel shutdown

processShutdownSignal

public void processShutdownSignal(ShutdownSignalException signal,
                                  boolean ignoreClosed,
                                  boolean notifyRpc)
Protected API - overridden to broadcast the signal to all consumers before calling the superclass's method.

Overrides:
processShutdownSignal in class AMQChannel
Parameters:
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

releaseChannelNumber

public void releaseChannelNumber()

processAsync

public boolean processAsync(Command command)
                     throws java.io.IOException
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:
processAsync in class AMQChannel
Parameters:
command - the command to handle asynchronously
Returns:
true if we handled the command; otherwise the caller should consider it "unhandled"
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Public API - Close this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'.

Specified by:
close in interface Channel
Throws:
java.io.IOException - if an error is encountered

close

public void close(int closeCode,
                  java.lang.String closeMessage)
           throws java.io.IOException
Public API - Close this channel.

Specified by:
close in interface Channel
Parameters:
closeCode - the close code (See under "Reply Codes" in the AMQP specification)
closeMessage - a message indicating the reason for closing the connection
Throws:
java.io.IOException - if an error is encountered

abort

public void abort()
           throws java.io.IOException
Public API - Abort this channel with the AMQP.REPLY_SUCCESS close code and message 'OK'. Forces the channel to close and waits for the close operation to complete. Any encountered exceptions in the close operation are silently discarded.

Specified by:
abort in interface Channel
Throws:
java.io.IOException

abort

public void abort(int closeCode,
                  java.lang.String closeMessage)
           throws java.io.IOException
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:
abort in interface Channel
Throws:
java.io.IOException

close

public void close(int closeCode,
                  java.lang.String closeMessage,
                  boolean initiatedByApplication,
                  java.lang.Throwable cause,
                  boolean abort)
           throws java.io.IOException
Protected API - Close channel with code and message, indicating the source of the closure and a causing exception (null if none).

Throws:
java.io.IOException

basicQos

public void basicQos(int prefetchSize,
                     int prefetchCount,
                     boolean global)
              throws java.io.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 the receipt of acknowledgements. Thus they provide a means of consumer-initiated flow control.

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

basicQos

public void basicQos(int prefetchCount)
              throws java.io.IOException
Public API - Request a specific prefetchCount "quality of service" settings for this channel.

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

basicPublish

public void basicPublish(java.lang.String exchange,
                         java.lang.String routingKey,
                         AMQP.BasicProperties props,
                         byte[] body)
                  throws java.io.IOException
Public API - Publish a message with both "mandatory" and "immediate" flags set to false

Specified by:
basicPublish in interface Channel
Parameters:
exchange - the exchange to publish the message to
routingKey - the routing key
props - other properties for the message - routing headers etc
body - the message body
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Publish

basicPublish

public void basicPublish(java.lang.String exchange,
                         java.lang.String routingKey,
                         boolean mandatory,
                         boolean immediate,
                         AMQP.BasicProperties props,
                         byte[] body)
                  throws java.io.IOException
Public API - Publish a message

Specified by:
basicPublish in interface Channel
Parameters:
exchange - the exchange to publish the message to
routingKey - the routing key
mandatory - true if we are requesting a mandatory publish
immediate - true if we are requesting an immediate publish
props - other properties for the message - routing headers etc
body - the message body
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Publish

exchangeDeclare

public AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange,
                                                  java.lang.String type,
                                                  boolean durable,
                                                  boolean autoDelete,
                                                  java.util.Map<java.lang.String,java.lang.Object> arguments)
                                           throws java.io.IOException
Public API - Declare an exchange, via an interface that allows the complete set of arguments.

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

exchangeDeclare

public AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange,
                                                  java.lang.String type,
                                                  boolean durable)
                                           throws java.io.IOException
Public API - Actively declare a non-autodelete exchange with no extra arguments

Specified by:
exchangeDeclare in interface Channel
Parameters:
exchange - the name of the exchange
type - the exchange type
durable - true if we are declaring a durable exchange (the exchange will survive a server restart)
Returns:
a declaration-confirm method to indicate the exchange was successfully declared
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk

exchangeDeclare

public AMQImpl.Exchange.DeclareOk exchangeDeclare(java.lang.String exchange,
                                                  java.lang.String type)
                                           throws java.io.IOException
Public API - Actively declare a non-autodelete, non-durable exchange with no extra arguments

Specified by:
exchangeDeclare in interface Channel
Parameters:
exchange - the name of the exchange
type - the exchange type
Returns:
a declaration-confirm method to indicate the exchange was successfully declared
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Exchange.Declare, AMQP.Exchange.DeclareOk

exchangeDeclarePassive

public AMQImpl.Exchange.DeclareOk exchangeDeclarePassive(java.lang.String exchange)
                                                  throws java.io.IOException
Public API - Declare an exchange passively; that is, check if the named exchange exists.

Specified by:
exchangeDeclarePassive in interface Channel
Parameters:
exchange - check the existence of an exchange named this
Throws:
java.io.IOException - the server will raise a 404 channel exception if the named exchange does not exist.

exchangeDelete

public AMQImpl.Exchange.DeleteOk exchangeDelete(java.lang.String exchange,
                                                boolean ifUnused)
                                         throws java.io.IOException
Public API - Delete an exchange

Specified by:
exchangeDelete in interface Channel
Parameters:
exchange - the name of the exchange
ifUnused - true to indicate that the exchange is only to be deleted if it is unused
Returns:
a deletion-confirm method to indicate the exchange was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Exchange.Delete, AMQP.Exchange.DeleteOk

exchangeDelete

public AMQImpl.Exchange.DeleteOk exchangeDelete(java.lang.String exchange)
                                         throws java.io.IOException
Public API - Delete an exchange, without regard for whether it is in use or not

Specified by:
exchangeDelete in interface Channel
Parameters:
exchange - the name of the exchange
Returns:
a deletion-confirm method to indicate the exchange was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Exchange.Delete, AMQP.Exchange.DeleteOk

queueDeclare

public AMQImpl.Queue.DeclareOk queueDeclare(java.lang.String queue,
                                            boolean durable,
                                            boolean exclusive,
                                            boolean autoDelete,
                                            java.util.Map<java.lang.String,java.lang.Object> arguments)
                                     throws java.io.IOException
Public API - Declare a queue

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

queueDeclare

public AMQP.Queue.DeclareOk queueDeclare()
                                  throws java.io.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 AMQP.Queue.DeclareOk result.

Specified by:
queueDeclare in interface Channel
Returns:
a declaration-confirm method to indicate the queue was successfully declared
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Declare, AMQP.Queue.DeclareOk

queueDeclarePassive

public AMQImpl.Queue.DeclareOk queueDeclarePassive(java.lang.String queue)
                                            throws java.io.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.

Specified by:
queueDeclarePassive in interface Channel
Parameters:
queue - the name of the queue
Returns:
a declaration-confirm method to indicate the queue exists
Throws:
java.io.IOException - if an error is encountered, including if the queue does not exist and if the queue is exclusively owned by another connection.
See Also:
AMQP.Queue.Declare, AMQP.Queue.DeclareOk

queueDelete

public AMQImpl.Queue.DeleteOk queueDelete(java.lang.String queue,
                                          boolean ifUnused,
                                          boolean ifEmpty)
                                   throws java.io.IOException
Public API - Delete a queue

Specified by:
queueDelete in interface Channel
Parameters:
queue - the name of the queue
ifUnused - true if the queue should be deleted only if not in use
ifEmpty - true if the queue should be deleted only if empty
Returns:
a deletion-confirm method to indicate the queue was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Delete, AMQP.Queue.DeleteOk

queueDelete

public AMQImpl.Queue.DeleteOk queueDelete(java.lang.String queue)
                                   throws java.io.IOException
Public API - Delete a queue, without regard for whether it is in use or has messages on it

Specified by:
queueDelete in interface Channel
Parameters:
queue - the name of the queue
Returns:
a deletion-confirm method to indicate the queue was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Delete, AMQP.Queue.DeleteOk

queueBind

public AMQImpl.Queue.BindOk queueBind(java.lang.String queue,
                                      java.lang.String exchange,
                                      java.lang.String routingKey,
                                      java.util.Map<java.lang.String,java.lang.Object> arguments)
                               throws java.io.IOException
Public API - Bind a queue to an exchange.

Specified by:
queueBind in interface Channel
Parameters:
queue - the name of the queue
exchange - the name of the exchange
routingKey - the routine key to use for the binding
arguments - other properties (binding parameters)
Returns:
a binding-confirm method if the binding was successfully created
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Bind, AMQP.Queue.BindOk

queueBind

public AMQImpl.Queue.BindOk queueBind(java.lang.String queue,
                                      java.lang.String exchange,
                                      java.lang.String routingKey)
                               throws java.io.IOException
Public API - Bind a queue to an exchange, with no extra arguments.

Specified by:
queueBind in interface Channel
Parameters:
queue - the name of the queue
exchange - the name of the exchange
routingKey - the routine key to use for the binding
Returns:
a binding-confirm method if the binding was successfully created
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Bind, AMQP.Queue.BindOk

queueUnbind

public AMQImpl.Queue.UnbindOk queueUnbind(java.lang.String queue,
                                          java.lang.String exchange,
                                          java.lang.String routingKey,
                                          java.util.Map<java.lang.String,java.lang.Object> arguments)
                                   throws java.io.IOException
Public API - Unbind a queue from an exchange.

Specified by:
queueUnbind in interface Channel
Parameters:
queue - the name of the queue
exchange - the name of the exchange
routingKey - the routine key to use for the binding
arguments - other properties (binding parameters)
Returns:
an unbinding-confirm method if the binding was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Unbind, AMQP.Queue.UnbindOk

queuePurge

public AMQImpl.Queue.PurgeOk queuePurge(java.lang.String queue)
                                 throws java.io.IOException
Public API - Purges the contents of the given queue.

Specified by:
queuePurge in interface Channel
Parameters:
queue - the name of the queue
Returns:
a purge-confirm method if the purge was executed succesfully
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Purge, AMQP.Queue.PurgeOk

queueUnbind

public AMQImpl.Queue.UnbindOk queueUnbind(java.lang.String queue,
                                          java.lang.String exchange,
                                          java.lang.String routingKey)
                                   throws java.io.IOException
Public API - Unbinds a queue from an exchange, with no extra arguments.

Specified by:
queueUnbind in interface Channel
Parameters:
queue - the name of the queue
exchange - the name of the exchange
routingKey - the routine key to use for the binding
Returns:
an unbinding-confirm method if the binding was successfully deleted
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Queue.Unbind, AMQP.Queue.UnbindOk

basicGet

public GetResponse basicGet(java.lang.String queue,
                            boolean noAck)
                     throws java.io.IOException
Public API - Retrieve a message from a queue using AMQP.Basic.Get

Specified by:
basicGet in interface Channel
Parameters:
queue - the name of the queue
noAck - true if no handshake is required
Returns:
a GetResponse containing the retrieved message data
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Get, AMQP.Basic.GetOk, AMQP.Basic.GetEmpty

basicAck

public void basicAck(long deliveryTag,
                     boolean multiple)
              throws java.io.IOException
Public API - Acknowledge one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being acknowledged.

Specified by:
basicAck in interface Channel
Parameters:
deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.Basic.Deliver
multiple - true if we are acknowledging multiple messages with the same delivery tag
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Ack

basicReject

public void basicReject(long deliveryTag,
                        boolean requeue)
                 throws java.io.IOException
Public API - Reject a message. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being rejected.

Specified by:
basicReject in interface Channel
Parameters:
deliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.Basic.Deliver
requeue - true if the rejected message should be requeued rather than discarded/dead-lettered
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Reject

basicConsume

public java.lang.String basicConsume(java.lang.String queue,
                                     Consumer callback)
                              throws java.io.IOException
Public API - Start a non-nolocal, non-exclusive consumer, with explicit acknowledgements required and a server-generated consumerTag.

Specified by:
basicConsume in interface Channel
Parameters:
queue - the name of the queue
callback - an interface to the consumer object
Returns:
the consumerTag generated by the server
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicAck(long, boolean), Channel.basicConsume(String,boolean, String,boolean,boolean, Map, Consumer)

basicConsume

public java.lang.String basicConsume(java.lang.String queue,
                                     boolean noAck,
                                     Consumer callback)
                              throws java.io.IOException
Public API - Start a non-nolocal, non-exclusive consumer, with a server-generated consumerTag.

Specified by:
basicConsume in interface Channel
Parameters:
queue - the name of the queue
noAck - true if no handshake is required
callback - an interface to the consumer object
Returns:
the consumerTag generated by the server
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String,boolean, String,boolean,boolean, Map, Consumer)

basicConsume

public java.lang.String basicConsume(java.lang.String queue,
                                     boolean noAck,
                                     java.lang.String consumerTag,
                                     Consumer callback)
                              throws java.io.IOException
Public API - Start a non-nolocal, non-exclusive consumer.

Specified by:
basicConsume in interface Channel
Parameters:
queue - the name of the queue
noAck - true if no handshake is required
consumerTag - a client-generated consumer tag to establish context
callback - an interface to the consumer object
Returns:
the consumerTag associated with the new consumer
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Consume, AMQP.Basic.ConsumeOk, Channel.basicConsume(String,boolean, String,boolean,boolean, Map, Consumer)

basicConsume

public java.lang.String basicConsume(java.lang.String queue,
                                     boolean noAck,
                                     java.lang.String consumerTag,
                                     boolean noLocal,
                                     boolean exclusive,
                                     java.util.Map<java.lang.String,java.lang.Object> arguments,
                                     Consumer callback)
                              throws java.io.IOException
Public API - Start a consumer. Calls the consumer's Consumer.handleConsumeOk(java.lang.String) method before returning.

Specified by:
basicConsume in interface Channel
Parameters:
queue - the name of the queue
noAck - true if no handshake is required
consumerTag - a client-generated consumer tag to establish context
noLocal - flag set to true unless server local buffering is required
exclusive - true if this is an exclusive consumer
arguments - a set of arguments for the consume
callback - an interface to the consumer object
Returns:
the consumerTag associated with the new consumer
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Consume, AMQP.Basic.ConsumeOk

basicCancel

public void basicCancel(java.lang.String consumerTag)
                 throws java.io.IOException
Public API - Cancel a consumer. Calls the consumer's Consumer.handleCancelOk(java.lang.String) method before returning.

Specified by:
basicCancel in interface Channel
Parameters:
consumerTag - a client- or server-generated consumer tag to establish context
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Basic.Cancel, AMQP.Basic.CancelOk

basicRecover

public AMQImpl.Basic.RecoverOk basicRecover(boolean requeue)
                                     throws java.io.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.

Specified by:
basicRecover in interface Channel
Parameters:
requeue - If true, messages will be requeued and possibly delivered to a different consumer. If false, messages will be redelivered to the same consumer.
Throws:
java.io.IOException

basicRecoverAsync

public void basicRecoverAsync(boolean requeue)
                       throws java.io.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.

Specified by:
basicRecoverAsync in interface Channel
Parameters:
requeue - If true, messages will be requeued and possibly delivered to a different consumer. If false, messages will be redelivered to the same consumer.
Throws:
java.io.IOException

txSelect

public AMQImpl.Tx.SelectOk txSelect()
                             throws java.io.IOException
Public API - Enables TX mode on this channel.

Specified by:
txSelect in interface Channel
Returns:
a transaction-selection method to indicate the transaction was successfully initiated
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Tx.Select, AMQP.Tx.SelectOk

txCommit

public AMQImpl.Tx.CommitOk txCommit()
                             throws java.io.IOException
Public API - Commits a TX transaction on this channel.

Specified by:
txCommit in interface Channel
Returns:
a transaction-commit method to indicate the transaction was successfully committed
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Tx.Commit, AMQP.Tx.CommitOk

txRollback

public AMQImpl.Tx.RollbackOk txRollback()
                                 throws java.io.IOException
Public API - Rolls back a TX transaction on this channel.

Specified by:
txRollback in interface Channel
Returns:
a transaction-rollback method to indicate the transaction was successfully rolled back
Throws:
java.io.IOException - if an error is encountered
See Also:
AMQP.Tx.Rollback, AMQP.Tx.RollbackOk

flow

public AMQImpl.Channel.FlowOk flow(boolean a)
                            throws java.io.IOException
Public API - Set flow on the channel

Specified by:
flow in interface Channel
Parameters:
a - if true, the server is asked to start sending. If false, the server is asked to stop sending.
Throws:
java.io.IOException

getFlow

public AMQImpl.Channel.FlowOk getFlow()
Public API - Return the current Channel.Flow settings.

Specified by:
getFlow in interface Channel