|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.rabbitmq.client.impl.AMQChannel
com.rabbitmq.client.impl.ChannelN
public class ChannelN
Main interface to AMQP protocol functionality. Public API - Implementation of all AMQChannels except channel zero.
To open a channel,
Connectionconn = ...;ChannelNch1 = conn.createChannel(1); ch1.open(""); int ticket = ch1.accessRequest(realmName);
| 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. |
static int |
CLOSING_TIMEOUT
|
ReturnListener |
returnListener
Reference to the currently-active ReturnListener, or null if there is none. |
| Fields inherited from class com.rabbitmq.client.impl.AMQChannel |
|---|
_activeRpc, _channelNumber, _commandAssembler, _connection, _isOpen |
| Constructor Summary | |
|---|---|
ChannelN(AMQConnection connection,
int channelNumber)
Construct a new channel on the given connection with the given channel number. |
|
| Method Summary | |
|---|---|
int |
accessRequest(java.lang.String realm)
Public API - Request an access ticket for the named realm For compatibility reasons it is possible to suppress the sending of the request with ConnectionParameters.setSuppressAccessRequest(boolean) |
int |
accessRequest(java.lang.String realm,
boolean exclusive,
boolean passive,
boolean active,
boolean write,
boolean read)
Public API - Request an access ticket for the named realm and the given role and exclusivity flags For compatibility reasons it is possible to suppress the sending of the request with ConnectionParameters.setSuppressAccessRequest(boolean) |
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(int ticket,
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(int ticket,
java.lang.String queue,
boolean noAck,
java.lang.String consumerTag,
boolean noLocal,
boolean exclusive,
Consumer callback)
Public API - Start a consumer. |
java.lang.String |
basicConsume(int ticket,
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(int ticket,
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(int ticket,
java.lang.String queue,
boolean noAck)
Public API - Retrieve a message from a queue using AMQP.Basic.Get |
void |
basicPublish(int ticket,
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(int ticket,
java.lang.String exchange,
java.lang.String routingKey,
boolean mandatory,
boolean immediate,
AMQP.BasicProperties props,
byte[] body)
Public API - Publish a message |
void |
broadcastShutdownSignal(ShutdownSignalException signal)
Protected API - sends a ShutdownSignal to all active consumers. |
void |
close(int closeCode,
java.lang.String closeMessage)
Public API - closes this channel with the given code and message |
void |
close(int closeCode,
java.lang.String closeMessage,
boolean initiatedByApplication,
java.lang.Throwable cause)
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(int ticket,
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(int ticket,
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(int ticket,
java.lang.String exchange,
java.lang.String type,
boolean passive,
boolean durable,
boolean autoDelete,
java.util.Map<java.lang.String,java.lang.Object> arguments)
Public API - Declare an exchange |
AMQImpl.Exchange.DeleteOk |
exchangeDelete(int ticket,
java.lang.String exchange)
Public API - Delete an exchange, without regard for whether it is in use or not |
AMQImpl.Exchange.DeleteOk |
exchangeDelete(int ticket,
java.lang.String exchange,
boolean ifUnused)
Public API - Delete an exchange |
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)
Protected API - overridden to broadcast the signal to all consumers before calling the superclass's method. |
AMQImpl.Queue.BindOk |
queueBind(int ticket,
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(int ticket,
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(int ticket)
Public API - Actively declare a server-named exclusive, autodelete, non-durable queue. |
AMQImpl.Queue.DeclareOk |
queueDeclare(int ticket,
java.lang.String queue)
Public API - Actively declare a non-exclusive, non-autodelete, non-durable queue |
AMQImpl.Queue.DeclareOk |
queueDeclare(int ticket,
java.lang.String queue,
boolean durable)
Public API - Actively declare a non-exclusive, non-autodelete queue |
AMQImpl.Queue.DeclareOk |
queueDeclare(int ticket,
java.lang.String queue,
boolean passive,
boolean durable,
boolean exclusive,
boolean autoDelete,
java.util.Map<java.lang.String,java.lang.Object> arguments)
Public API - Declare a queue |
AMQImpl.Queue.DeleteOk |
queueDelete(int ticket,
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(int ticket,
java.lang.String queue,
boolean ifUnused,
boolean ifEmpty)
Public API - Delete a queue |
void |
releaseChannelNumber()
|
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, isOpen, nextOutstandingRpc, quiescingRpc, rpc, rpc, toString, transmit, transmitAndEnqueue, wrap |
| 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 |
| Field Detail |
|---|
public static final int CLOSING_TIMEOUT
public final java.util.Map<java.lang.String,Consumer> _consumers
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.
public volatile ReturnListener returnListener
| Constructor Detail |
|---|
public ChannelN(AMQConnection connection,
int channelNumber)
connection - The connection associated with this channelchannelNumber - The channel number to be associated with this channelConnection.createChannel()| Method Detail |
|---|
public void open()
throws java.io.IOException
java.io.IOException - if any problem is encounteredpublic ReturnListener getReturnListener()
getReturnListener in interface Channelpublic void setReturnListener(ReturnListener listener)
setReturnListener in interface Channellistener - the listener to use, or null indicating "don't use one".public void broadcastShutdownSignal(ShutdownSignalException signal)
signal - an exception signalling channel shutdownpublic void processShutdownSignal(ShutdownSignalException signal)
processShutdownSignal in class AMQChannelsignal - the signal to handlepublic void releaseChannelNumber()
public boolean processAsync(Command command)
throws java.io.IOException
processAsync in class AMQChannelcommand - the command to handle asynchronously
java.io.IOException
public void close(int closeCode,
java.lang.String closeMessage)
throws java.io.IOException
close in interface ChannelcloseCode - the close code (See under "Reply Codes" in the AMQP specification)closeMessage - a message indicating the reason for closing the channel
java.io.IOException - if an error is encountered
public void close(int closeCode,
java.lang.String closeMessage,
boolean initiatedByApplication,
java.lang.Throwable cause)
throws java.io.IOException
java.io.IOException
public int accessRequest(java.lang.String realm)
throws java.io.IOException
ConnectionParameters.setSuppressAccessRequest(boolean)
accessRequest in interface Channelrealm - the name of the realm
java.io.IOException - if an error is encountered e.g. we don't have permissionAMQP.Access.Request
public int accessRequest(java.lang.String realm,
boolean exclusive,
boolean passive,
boolean active,
boolean write,
boolean read)
throws java.io.IOException
ConnectionParameters.setSuppressAccessRequest(boolean)
accessRequest in interface Channelrealm - the name of the realmexclusive - true if we are requesting exclusive accesspassive - true if we are requesting passive accessactive - true if we are requesting active accesswrite - true if we are requesting write accessread - true if we are requesting read access
java.io.IOException - if an error is encountered e.g. we don't have permissionAMQP.Access.Request
public void basicPublish(int ticket,
java.lang.String exchange,
java.lang.String routingKey,
AMQP.BasicProperties props,
byte[] body)
throws java.io.IOException
basicPublish in interface Channelticket - an access ticket for the appropriate realmexchange - the exchange to publish the message toroutingKey - the routing keyprops - other properties for the message - routing headers etcbody - the message body
java.io.IOException - if an error is encounteredAMQP.Basic.Publish
public void basicPublish(int ticket,
java.lang.String exchange,
java.lang.String routingKey,
boolean mandatory,
boolean immediate,
AMQP.BasicProperties props,
byte[] body)
throws java.io.IOException
basicPublish in interface Channelticket - an access ticket for the appropriate realmexchange - the exchange to publish the message toroutingKey - the routing keymandatory - true if we are requesting a mandatory publishimmediate - true if we are requesting an immediate publishprops - other properties for the message - routing headers etcbody - the message body
java.io.IOException - if an error is encounteredAMQP.Basic.Publish
public AMQImpl.Exchange.DeclareOk exchangeDeclare(int ticket,
java.lang.String exchange,
java.lang.String type,
boolean passive,
boolean durable,
boolean autoDelete,
java.util.Map<java.lang.String,java.lang.Object> arguments)
throws java.io.IOException
exchangeDeclare in interface Channelticket - an access ticket for the appropriate realmexchange - the name of the exchangetype - the exchange typepassive - true if we are passively declaring a exchange (asserting the exchange already exists)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 usearguments - other properties (construction arguments) for the exchange
java.io.IOException - if an error is encounteredAMQP.Exchange.Declare,
AMQP.Exchange.DeclareOk
public AMQImpl.Exchange.DeclareOk exchangeDeclare(int ticket,
java.lang.String exchange,
java.lang.String type,
boolean durable)
throws java.io.IOException
exchangeDeclare in interface Channelticket - an access ticket for the appropriate realmexchange - the name of the exchangetype - the exchange typedurable - true if we are declaring a durable exchange (the exchange will survive a server restart)
java.io.IOException - if an error is encounteredAMQP.Exchange.Declare,
AMQP.Exchange.DeclareOk
public AMQImpl.Exchange.DeclareOk exchangeDeclare(int ticket,
java.lang.String exchange,
java.lang.String type)
throws java.io.IOException
exchangeDeclare in interface Channelticket - an access ticket for the appropriate realmexchange - the name of the exchangetype - the exchange type
java.io.IOException - if an error is encounteredAMQP.Exchange.Declare,
AMQP.Exchange.DeclareOk
public AMQImpl.Exchange.DeleteOk exchangeDelete(int ticket,
java.lang.String exchange,
boolean ifUnused)
throws java.io.IOException
exchangeDelete in interface Channelticket - an access ticket for the appropriate realmexchange - the name of the exchangeifUnused - true to indicate that the exchange is only to be deleted if it is unused
java.io.IOException - if an error is encounteredAMQP.Exchange.Delete,
AMQP.Exchange.DeleteOk
public AMQImpl.Exchange.DeleteOk exchangeDelete(int ticket,
java.lang.String exchange)
throws java.io.IOException
exchangeDelete in interface Channelticket - an access ticket for the appropriate realmexchange - the name of the exchange
java.io.IOException - if an error is encounteredAMQP.Exchange.Delete,
AMQP.Exchange.DeleteOk
public AMQImpl.Queue.DeclareOk queueDeclare(int ticket,
java.lang.String queue,
boolean passive,
boolean durable,
boolean exclusive,
boolean autoDelete,
java.util.Map<java.lang.String,java.lang.Object> arguments)
throws java.io.IOException
queueDeclare in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuepassive - true if we are passively declaring a queue (asserting the queue already exists)durable - true if we are declaring a durable queue (the queue will survive a server restart)exclusive - true if we are declaring an exclusive queueautoDelete - 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
java.io.IOException - if an error is encounteredAMQP.Queue.Declare,
AMQP.Queue.DeclareOk
public AMQImpl.Queue.DeclareOk queueDeclare(int ticket,
java.lang.String queue,
boolean durable)
throws java.io.IOException
queueDeclare in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuedurable - true if we are declaring a durable exchange (the exchange will survive a server restart)
java.io.IOException - if an error is encounteredAMQP.Queue.Declare,
AMQP.Queue.DeclareOk
public AMQImpl.Queue.DeclareOk queueDeclare(int ticket,
java.lang.String queue)
throws java.io.IOException
queueDeclare in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queue
java.io.IOException - if an error is encounteredAMQP.Queue.Declare,
AMQP.Queue.DeclareOk
public AMQP.Queue.DeclareOk queueDeclare(int ticket)
throws java.io.IOException
AMQP.Queue.DeclareOk
result.
queueDeclare in interface Channelticket - an access ticket for the appropriate realm
java.io.IOException - if an error is encounteredAMQP.Queue.Declare,
AMQP.Queue.DeclareOk
public AMQImpl.Queue.DeleteOk queueDelete(int ticket,
java.lang.String queue,
boolean ifUnused,
boolean ifEmpty)
throws java.io.IOException
queueDelete in interface Channelticket - an access ticket for the appropriate realmqueue - 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
java.io.IOException - if an error is encounteredAMQP.Queue.Delete,
AMQP.Queue.DeleteOk
public AMQImpl.Queue.DeleteOk queueDelete(int ticket,
java.lang.String queue)
throws java.io.IOException
queueDelete in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queue
java.io.IOException - if an error is encounteredAMQP.Queue.Delete,
AMQP.Queue.DeleteOk
public AMQImpl.Queue.BindOk queueBind(int ticket,
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
queueBind in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queueexchange - the name of the exchangeroutingKey - the routine key to use for the bindingarguments - other properties (binding parameters)
java.io.IOException - if an error is encounteredAMQP.Queue.Bind,
AMQP.Queue.BindOk
public AMQImpl.Queue.BindOk queueBind(int ticket,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey)
throws java.io.IOException
queueBind in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queueexchange - the name of the exchangeroutingKey - the routine key to use for the binding
java.io.IOException - if an error is encounteredAMQP.Queue.Bind,
AMQP.Queue.BindOk
public GetResponse basicGet(int ticket,
java.lang.String queue,
boolean noAck)
throws java.io.IOException
AMQP.Basic.Get
basicGet in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuenoAck - true if no handshake is required
GetResponse containing the retrieved message data
java.io.IOException - if an error is encounteredAMQP.Basic.Get,
AMQP.Basic.GetOk,
AMQP.Basic.GetEmpty
public void basicAck(long deliveryTag,
boolean multiple)
throws java.io.IOException
AMQP.Basic.GetOk
or AMQP.Basic.Deliver method
containing the received message being acknowledged.
basicAck in interface ChanneldeliveryTag - the tag from the received AMQP.Basic.GetOk or AMQP.Basic.Delivermultiple - true if we are acknowledging multiple messages with the same delivery tag
java.io.IOException - if an error is encounteredAMQP.Basic.Ack
public java.lang.String basicConsume(int ticket,
java.lang.String queue,
Consumer callback)
throws java.io.IOException
basicConsume in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuecallback - an interface to the consumer object
java.io.IOException - if an error is encounteredAMQP.Basic.Consume,
AMQP.Basic.ConsumeOk,
basicAck(long, boolean),
basicConsume(int,String,boolean,String,boolean,boolean,Consumer)
public java.lang.String basicConsume(int ticket,
java.lang.String queue,
boolean noAck,
Consumer callback)
throws java.io.IOException
basicConsume in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuenoAck - true if no handshake is requiredcallback - an interface to the consumer object
java.io.IOException - if an error is encounteredAMQP.Basic.Consume,
AMQP.Basic.ConsumeOk,
basicConsume(int,String,boolean,String,boolean,boolean,Consumer)
public java.lang.String basicConsume(int ticket,
java.lang.String queue,
boolean noAck,
java.lang.String consumerTag,
Consumer callback)
throws java.io.IOException
basicConsume in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuenoAck - true if no handshake is requiredconsumerTag - a client-generated consumer tag to establish contextcallback - an interface to the consumer object
java.io.IOException - if an error is encounteredAMQP.Basic.Consume,
AMQP.Basic.ConsumeOk,
basicConsume(int,String,boolean,String,boolean,boolean,Consumer)
public java.lang.String basicConsume(int ticket,
java.lang.String queue,
boolean noAck,
java.lang.String consumerTag,
boolean noLocal,
boolean exclusive,
Consumer callback)
throws java.io.IOException
Consumer.handleConsumeOk(java.lang.String)
method before returning.
basicConsume in interface Channelticket - an access ticket for the appropriate realmqueue - the name of the queuenoAck - true if no handshake is requiredconsumerTag - a client-generated consumer tag to establish contextnoLocal - flag set to true unless server local buffering is requiredexclusive - true if this is an exclusive consumercallback - an interface to the consumer object
java.io.IOException - if an error is encounteredAMQP.Basic.Consume,
AMQP.Basic.ConsumeOk
public void basicCancel(java.lang.String consumerTag)
throws java.io.IOException
Consumer.handleCancelOk(java.lang.String)
method before returning.
basicCancel in interface ChannelconsumerTag - a client- or server-generated consumer tag to establish context
java.io.IOException - if an error is encounteredAMQP.Basic.Cancel,
AMQP.Basic.CancelOk
public AMQImpl.Tx.SelectOk txSelect()
throws java.io.IOException
txSelect in interface Channeljava.io.IOException - if an error is encounteredAMQP.Tx.Select,
AMQP.Tx.SelectOk
public AMQImpl.Tx.CommitOk txCommit()
throws java.io.IOException
txCommit in interface Channeljava.io.IOException - if an error is encounteredAMQP.Tx.Commit,
AMQP.Tx.CommitOk
public AMQImpl.Tx.RollbackOk txRollback()
throws java.io.IOException
txRollback in interface Channeljava.io.IOException - if an error is encounteredAMQP.Tx.Rollback,
AMQP.Tx.RollbackOk
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||