//  The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License
// at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
// the License for the specific language governing rights and
// limitations under the License.
//
// The Original Code is RabbitMQ.
//
// The Initial Developer of the Original Code is VMware, Inc.
// Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
// package com.rabbitmq.client; import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeoutException; import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.AMQP.Exchange;
import com.rabbitmq.client.AMQP.Queue;
import com.rabbitmq.client.AMQP.Tx;
import com.rabbitmq.client.AMQP.Basic;
import com.rabbitmq.client.AMQP.Confirm;
import com.rabbitmq.client.AMQP.Channel.FlowOk; /**
* Public API: Interface to an AMQ channel. See the <a href="http://www.amqp.org/">spec</a> for details.
*
* <p>
* To open a channel,
* <pre>
* {@link Connection} conn = ...;
* {@link Channel} channel = conn.{@link Connection#createChannel createChannel}();
* </pre>
* <p>
* Public API:
* <ul>
* <li> getChannelNumber
* <li> close
* </ul>
* <p>
*
* While a Channel can be used by multiple threads, it's important to ensure
* that only one thread executes a command at once. Concurrent execution of
* commands will likely cause an UnexpectedFrameError to be thrown.
*
*/ public interface Channel extends ShutdownNotifier {
/**
* Retrieve this channel's channel number.
* @return the channel number
*/
int getChannelNumber(); /**
* Retrieve the connection which carries this channel.
* @return the underlying {@link Connection}
*/
Connection getConnection(); /**
* Close this channel with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
* and message 'OK'.
*
* @throws java.io.IOException if an error is encountered
*/
void close() throws IOException; /**
* Close this channel.
*
* @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
* @param closeMessage a message indicating the reason for closing the connection
* @throws java.io.IOException if an error is encountered
*/
void close(int closeCode, String closeMessage) throws IOException; /**
* Set flow on the channel
*
* @param active if true, the server is asked to start sending. If false, the server is asked to stop sending.
* @throws IOException
*/
FlowOk flow(boolean active) throws IOException; /**
* Return the current Channel.Flow settings.
*/
FlowOk getFlow(); /**
* Abort this channel with the {@link com.rabbitmq.client.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.
*/
void abort() throws IOException; /**
* 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.
*/
void abort(int closeCode, String closeMessage) throws IOException; /**
* Add a {@link ReturnListener}.
* @param listener the listener to add
*/
void addReturnListener(ReturnListener listener); /**
* Remove a {@link ReturnListener}.
* @param listener the listener to remove
* @return <code><b>true</b></code> if the listener was found and removed,
* <code><b>false</b></code> otherwise
*/
boolean removeReturnListener(ReturnListener listener); /**
* Remove all {@link ReturnListener}s.
*/
void clearReturnListeners(); /**
* Add a {@link FlowListener}.
* @param listener the listener to add
*/
void addFlowListener(FlowListener listener); /**
* Remove a {@link FlowListener}.
* @param listener the listener to remove
* @return <code><b>true</b></code> if the listener was found and removed,
* <code><b>false</b></code> otherwise
*/
boolean removeFlowListener(FlowListener listener); /**
* Remove all {@link FlowListener}s.
*/
void clearFlowListeners(); /**
* Add a {@link ConfirmListener}.
* @param listener the listener to add
*/
void addConfirmListener(ConfirmListener listener); /**
* Remove a {@link ConfirmListener}.
* @param listener the listener to remove
* @return <code><b>true</b></code> if the listener was found and removed,
* <code><b>false</b></code> otherwise
*/
boolean removeConfirmListener(ConfirmListener listener); /**
* Remove all {@link ConfirmListener}s.
*/
void clearConfirmListeners(); /**
* Get the current default consumer. @see setDefaultConsumer for rationale.
* @return an interface to the current default consumer.
*/
Consumer getDefaultConsumer(); /**
* Set the current default consumer.
*
* Under certain circumstances it is possible for a channel to receive a
* message delivery which does not match any consumer which is currently
* set up via basicConsume(). This will occur after the following sequence
* of events:
*
* ctag = basicConsume(queue, consumer); // i.e. with explicit acks
* // some deliveries take place but are not acked
* basicCancel(ctag);
* basicRecover(false);
*
* Since requeue is specified to be false in the basicRecover, the spec
* states that the message must be redelivered to "the original recipient"
* - i.e. the same channel / consumer-tag. But the consumer is no longer
* active.
*
* In these circumstances, you can register a default consumer to handle
* such deliveries. If no default consumer is registered an
* IllegalStateException will be thrown when such a delivery arrives.
*
* Most people will not need to use this.
*
* @param consumer the consumer to use, or null indicating "don't use one".
*/
void setDefaultConsumer(Consumer consumer); /**
* 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.
* @see com.rabbitmq.client.AMQP.Basic.Qos
* @param prefetchSize maximum amount of content (measured in
* octets) that the server will deliver, 0 if unlimited
* @param prefetchCount maximum number of messages that the server
* will deliver, 0 if unlimited
* @param 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
*/
void basicQos(int prefetchSize, int prefetchCount, boolean global) throws IOException; /**
* Request a specific prefetchCount "quality of service" settings
* for this channel.
*
* @see #basicQos(int, int, boolean)
* @param prefetchCount maximum number of messages that the server
* will deliver, 0 if unlimited
* @throws java.io.IOException if an error is encountered
*/
void basicQos(int prefetchCount) throws IOException; /**
* Publish a message with both "mandatory" and "immediate" flags set to false
* @see com.rabbitmq.client.AMQP.Basic.Publish
* @param exchange the exchange to publish the message to
* @param routingKey the routing key
* @param props other properties for the message - routing headers etc
* @param body the message body
* @throws java.io.IOException if an error is encountered
*/
void basicPublish(String exchange, String routingKey, BasicProperties props, byte[] body) throws IOException; /**
* Publish a message
* @see com.rabbitmq.client.AMQP.Basic.Publish
* @param exchange the exchange to publish the message to
* @param routingKey the routing key
* @param mandatory true if we are requesting a mandatory publish
* @param immediate true if we are requesting an immediate publish
* @param props other properties for the message - routing headers etc
* @param body the message body
* @throws java.io.IOException if an error is encountered
*/
void basicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, BasicProperties props, byte[] body)
throws IOException; /**
* Actively declare a non-autodelete, non-durable exchange with no extra arguments
* @see com.rabbitmq.client.AMQP.Exchange.Declare
* @see com.rabbitmq.client.AMQP.Exchange.DeclareOk
* @param exchange the name of the exchange
* @param type the exchange type
* @return a declaration-confirm method to indicate the exchange was successfully declared
* @throws java.io.IOException if an error is encountered
*/
Exchange.DeclareOk exchangeDeclare(String exchange, String type) throws IOException; /**
* Actively declare a non-autodelete exchange with no extra arguments
* @see com.rabbitmq.client.AMQP.Exchange.Declare
* @see com.rabbitmq.client.AMQP.Exchange.DeclareOk
* @param exchange the name of the exchange
* @param type the exchange type
* @param durable true if we are declaring a durable exchange (the exchange will survive a server restart)
* @throws java.io.IOException if an error is encountered
* @return a declaration-confirm method to indicate the exchange was successfully declared
*/
Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable) throws IOException; /**
* Declare an exchange.
* @see com.rabbitmq.client.AMQP.Exchange.Declare
* @see com.rabbitmq.client.AMQP.Exchange.DeclareOk
* @param exchange the name of the exchange
* @param type the exchange type
* @param durable true if we are declaring a durable exchange (the exchange will survive a server restart)
* @param autoDelete true if the server should delete the exchange when it is no longer in use
* @param arguments other properties (construction arguments) for the exchange
* @return a declaration-confirm method to indicate the exchange was successfully declared
* @throws java.io.IOException if an error is encountered
*/
Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete,
Map<String, Object> arguments) throws IOException; /**
* Declare an exchange, via an interface that allows the complete set of
* arguments.
* @see com.rabbitmq.client.AMQP.Exchange.Declare
* @see com.rabbitmq.client.AMQP.Exchange.DeclareOk
* @param exchange the name of the exchange
* @param type the exchange type
* @param durable true if we are declaring a durable exchange (the exchange will survive a server restart)
* @param autoDelete true if the server should delete the exchange when it is no longer in use
* @param internal true if the exchange is internal, i.e. can't be directly
* published to by a client.
* @param arguments other properties (construction arguments) for the exchange
* @return a declaration-confirm method to indicate the exchange was successfully declared
* @throws java.io.IOException if an error is encountered
*/
Exchange.DeclareOk exchangeDeclare(String exchange,
String type,
boolean durable,
boolean autoDelete,
boolean internal,
Map<String, Object> arguments) throws IOException; /**
* Declare an exchange passively; that is, check if the named exchange exists.
* @param name check the existence of an exchange named this
* @throws IOException the server will raise a 404 channel exception if the named exchange does not exist.
*/
Exchange.DeclareOk exchangeDeclarePassive(String name) throws IOException; /**
* Delete an exchange
* @see com.rabbitmq.client.AMQP.Exchange.Delete
* @see com.rabbitmq.client.AMQP.Exchange.DeleteOk
* @param exchange the name of the exchange
* @param ifUnused true to indicate that the exchange is only to be deleted if it is unused
* @return a deletion-confirm method to indicate the exchange was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Exchange.DeleteOk exchangeDelete(String exchange, boolean ifUnused) throws IOException; /**
* Delete an exchange, without regard for whether it is in use or not
* @see com.rabbitmq.client.AMQP.Exchange.Delete
* @see com.rabbitmq.client.AMQP.Exchange.DeleteOk
* @param exchange the name of the exchange
* @return a deletion-confirm method to indicate the exchange was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Exchange.DeleteOk exchangeDelete(String exchange) throws IOException; /**
* Bind an exchange to an exchange, with no extra arguments.
* @see com.rabbitmq.client.AMQP.Exchange.Bind
* @see com.rabbitmq.client.AMQP.Exchange.BindOk
* @param destination: the name of the exchange to which messages flow across the binding
* @param source: the name of the exchange from which messages flow across the binding
* @param routingKey: the routine key to use for the binding
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Exchange.BindOk exchangeBind(String destination, String source, String routingKey) throws IOException; /**
* Bind an exchange to an exchange.
* @see com.rabbitmq.client.AMQP.Exchange.Bind
* @see com.rabbitmq.client.AMQP.Exchange.BindOk
* @param destination: the name of the exchange to which messages flow across the binding
* @param source: the name of the exchange from which messages flow across the binding
* @param routingKey: the routine key to use for the binding
* @param arguments: other properties (binding parameters)
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Exchange.BindOk exchangeBind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException; /**
* Unbind an exchange from an exchange, with no extra arguments.
* @see com.rabbitmq.client.AMQP.Exchange.Bind
* @see com.rabbitmq.client.AMQP.Exchange.BindOk
* @param destination: the name of the exchange to which messages flow across the binding
* @param source: the name of the exchange from which messages flow across the binding
* @param routingKey: the routine key to use for the binding
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey) throws IOException; /**
* Unbind an exchange from an exchange.
* @see com.rabbitmq.client.AMQP.Exchange.Bind
* @see com.rabbitmq.client.AMQP.Exchange.BindOk
* @param destination: the name of the exchange to which messages flow across the binding
* @param source: the name of the exchange from which messages flow across the binding
* @param routingKey: the routine key to use for the binding
* @param arguments: other properties (binding parameters)
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException; /**
* Actively declare a server-named exclusive, autodelete, non-durable queue.
* The name of the new queue is held in the "queue" field of the {@link com.rabbitmq.client.AMQP.Queue.DeclareOk} result.
* @see com.rabbitmq.client.AMQP.Queue.Declare
* @see com.rabbitmq.client.AMQP.Queue.DeclareOk
* @return a declaration-confirm method to indicate the queue was successfully declared
* @throws java.io.IOException if an error is encountered
*/
Queue.DeclareOk queueDeclare() throws IOException; /**
* Declare a queue
* @see com.rabbitmq.client.AMQP.Queue.Declare
* @see com.rabbitmq.client.AMQP.Queue.DeclareOk
* @param queue the name of the queue
* @param durable true if we are declaring a durable queue (the queue will survive a server restart)
* @param exclusive true if we are declaring an exclusive queue (restricted to this connection)
* @param autoDelete true if we are declaring an autodelete queue (server will delete it when no longer in use)
* @param arguments other properties (construction arguments) for the queue
* @return a declaration-confirm method to indicate the queue was successfully declared
* @throws java.io.IOException if an error is encountered
*/
Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete,
Map<String, Object> arguments) throws IOException; /**
* 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.
* @see com.rabbitmq.client.AMQP.Queue.Declare
* @see com.rabbitmq.client.AMQP.Queue.DeclareOk
* @param queue the name of the queue
* @return 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.
*/
Queue.DeclareOk queueDeclarePassive(String queue) throws IOException; /**
* Delete a queue, without regard for whether it is in use or has messages on it
* @see com.rabbitmq.client.AMQP.Queue.Delete
* @see com.rabbitmq.client.AMQP.Queue.DeleteOk
* @param queue the name of the queue
* @return a deletion-confirm method to indicate the queue was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Queue.DeleteOk queueDelete(String queue) throws IOException; /**
* Delete a queue
* @see com.rabbitmq.client.AMQP.Queue.Delete
* @see com.rabbitmq.client.AMQP.Queue.DeleteOk
* @param queue the name of the queue
* @param ifUnused true if the queue should be deleted only if not in use
* @param ifEmpty true if the queue should be deleted only if empty
* @return a deletion-confirm method to indicate the queue was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Queue.DeleteOk queueDelete(String queue, boolean ifUnused, boolean ifEmpty) throws IOException; /**
* Bind a queue to an exchange, with no extra arguments.
* @see com.rabbitmq.client.AMQP.Queue.Bind
* @see com.rabbitmq.client.AMQP.Queue.BindOk
* @param queue the name of the queue
* @param exchange the name of the exchange
* @param routingKey the routine key to use for the binding
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Queue.BindOk queueBind(String queue, String exchange, String routingKey) throws IOException; /**
* Bind a queue to an exchange.
* @see com.rabbitmq.client.AMQP.Queue.Bind
* @see com.rabbitmq.client.AMQP.Queue.BindOk
* @param queue the name of the queue
* @param exchange the name of the exchange
* @param routingKey the routine key to use for the binding
* @param arguments other properties (binding parameters)
* @return a binding-confirm method if the binding was successfully created
* @throws java.io.IOException if an error is encountered
*/
Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOException; /**
* Unbinds a queue from an exchange, with no extra arguments.
* @see com.rabbitmq.client.AMQP.Queue.Unbind
* @see com.rabbitmq.client.AMQP.Queue.UnbindOk
* @param queue the name of the queue
* @param exchange the name of the exchange
* @param routingKey the routine key to use for the binding
* @return an unbinding-confirm method if the binding was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey) throws IOException; /**
* Unbind a queue from an exchange.
* @see com.rabbitmq.client.AMQP.Queue.Unbind
* @see com.rabbitmq.client.AMQP.Queue.UnbindOk
* @param queue the name of the queue
* @param exchange the name of the exchange
* @param routingKey the routine key to use for the binding
* @param arguments other properties (binding parameters)
* @return an unbinding-confirm method if the binding was successfully deleted
* @throws java.io.IOException if an error is encountered
*/
Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOException; /**
* Purges the contents of the given queue.
* @see com.rabbitmq.client.AMQP.Queue.Purge
* @see com.rabbitmq.client.AMQP.Queue.PurgeOk
* @param queue the name of the queue
* @return a purge-confirm method if the purge was executed succesfully
* @throws java.io.IOException if an error is encountered
*/
Queue.PurgeOk queuePurge(String queue) throws IOException; /**
* Retrieve a message from a queue using {@link com.rabbitmq.client.AMQP.Basic.Get}
* @see com.rabbitmq.client.AMQP.Basic.Get
* @see com.rabbitmq.client.AMQP.Basic.GetOk
* @see com.rabbitmq.client.AMQP.Basic.GetEmpty
* @param queue the name of the queue
* @param autoAck true if the server should consider messages
* acknowledged once delivered; false if the server should expect
* explicit acknowledgements
* @return a {@link GetResponse} containing the retrieved message data
* @throws java.io.IOException if an error is encountered
*/
GetResponse basicGet(String queue, boolean autoAck) throws IOException; /**
* Acknowledge one or several received
* messages. Supply the deliveryTag from the {@link com.rabbitmq.client.AMQP.Basic.GetOk}
* or {@link com.rabbitmq.client.AMQP.Basic.Deliver} method
* containing the received message being acknowledged.
* @see com.rabbitmq.client.AMQP.Basic.Ack
* @param deliveryTag the tag from the received {@link com.rabbitmq.client.AMQP.Basic.GetOk} or {@link com.rabbitmq.client.AMQP.Basic.Deliver}
* @param multiple true to acknowledge all messages up to and
* including the supplied delivery tag; false to acknowledge just
* the supplied delivery tag.
* @throws java.io.IOException if an error is encountered
*/
void basicAck(long deliveryTag, boolean multiple) throws IOException; /**
* Reject one or several received messages.
*
* Supply the <code>deliveryTag</code> from the {@link com.rabbitmq.client.AMQP.Basic.GetOk}
* or {@link com.rabbitmq.client.AMQP.Basic.GetOk} method containing the message to be rejected.
* @see com.rabbitmq.client.AMQP.Basic.Nack
* @param deliveryTag the tag from the received {@link com.rabbitmq.client.AMQP.Basic.GetOk} or {@link com.rabbitmq.client.AMQP.Basic.Deliver}
* @param multiple true to reject all messages up to and including
* the supplied delivery tag; false to reject just the supplied
* delivery tag.
* @param requeue true if the rejected message(s) should be requeued rather
* than discarded/dead-lettered
* @throws java.io.IOException if an error is encountered
*/
void basicNack(long deliveryTag, boolean multiple, boolean requeue)
throws IOException; /**
* Reject a message. Supply the deliveryTag from the {@link com.rabbitmq.client.AMQP.Basic.GetOk}
* or {@link com.rabbitmq.client.AMQP.Basic.Deliver} method
* containing the received message being rejected.
* @see com.rabbitmq.client.AMQP.Basic.Reject
* @param deliveryTag the tag from the received {@link com.rabbitmq.client.AMQP.Basic.GetOk} or {@link com.rabbitmq.client.AMQP.Basic.Deliver}
* @param requeue true if the rejected message should be requeued rather than discarded/dead-lettered
* @throws java.io.IOException if an error is encountered
*/
void basicReject(long deliveryTag, boolean requeue) throws IOException; /**
* Start a non-nolocal, non-exclusive consumer, with
* explicit acknowledgement and a server-generated consumerTag.
* @param queue the name of the queue
* @param callback an interface to the consumer object
* @return the consumerTag generated by the server
* @throws java.io.IOException if an error is encountered
* @see com.rabbitmq.client.AMQP.Basic.Consume
* @see com.rabbitmq.client.AMQP.Basic.ConsumeOk
* @see #basicAck
* @see #basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
*/
String basicConsume(String queue, Consumer callback) throws IOException; /**
* Start a non-nolocal, non-exclusive consumer, with
* a server-generated consumerTag.
* @param queue the name of the queue
* @param autoAck true if the server should consider messages
* acknowledged once delivered; false if the server should expect
* explicit acknowledgements
* @param callback an interface to the consumer object
* @return the consumerTag generated by the server
* @throws java.io.IOException if an error is encountered
* @see com.rabbitmq.client.AMQP.Basic.Consume
* @see com.rabbitmq.client.AMQP.Basic.ConsumeOk
* @see #basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
*/
String basicConsume(String queue, boolean autoAck, Consumer callback) throws IOException; /**
* Start a non-nolocal, non-exclusive consumer.
* @param queue the name of the queue
* @param autoAck true if the server should consider messages
* acknowledged once delivered; false if the server should expect
* explicit acknowledgements
* @param consumerTag a client-generated consumer tag to establish context
* @param callback an interface to the consumer object
* @return the consumerTag associated with the new consumer
* @throws java.io.IOException if an error is encountered
* @see com.rabbitmq.client.AMQP.Basic.Consume
* @see com.rabbitmq.client.AMQP.Basic.ConsumeOk
* @see #basicConsume(String, boolean, String, boolean, boolean, Map, Consumer)
*/
String basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) throws IOException; /**
* Start a consumer. Calls the consumer's {@link Consumer#handleConsumeOk}
* method.
* @param queue the name of the queue
* @param autoAck true if the server should consider messages
* acknowledged once delivered; false if the server should expect
* explicit acknowledgements
* @param consumerTag a client-generated consumer tag to establish context
* @param noLocal true if the server should not deliver to this consumer
* messages published on this channel's connection
* @param exclusive true if this is an exclusive consumer
* @param callback an interface to the consumer object
* @param arguments a set of arguments for the consume
* @return the consumerTag associated with the new consumer
* @throws java.io.IOException if an error is encountered
* @see com.rabbitmq.client.AMQP.Basic.Consume
* @see com.rabbitmq.client.AMQP.Basic.ConsumeOk
*/
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOException; /**
* Cancel a consumer. Calls the consumer's {@link Consumer#handleCancelOk}
* method.
* @param 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 com.rabbitmq.client.AMQP.Basic.Cancel
* @see com.rabbitmq.client.AMQP.Basic.CancelOk
*/
void basicCancel(String consumerTag) throws IOException; /**
* 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.
* <p/>
* Equivalent to calling <code>basicRecover(true)</code>, messages
* will be requeued and possibly delivered to a different consumer.
* @see #basicRecover(boolean)
*/
Basic.RecoverOk basicRecover() throws IOException; /**
* 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.
* @param requeue If true, messages will be requeued and possibly
* delivered to a different consumer. If false, messages will be
* redelivered to the same consumer.
*/
Basic.RecoverOk basicRecover(boolean requeue) throws IOException; /**
* 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.
* @param requeue If true, messages will be requeued and possibly
* delivered to a different consumer. If false, messages will be
* redelivered to the same consumer.
*/
@Deprecated
void basicRecoverAsync(boolean requeue) throws IOException; /**
* Enables TX mode on this channel.
* @see com.rabbitmq.client.AMQP.Tx.Select
* @see com.rabbitmq.client.AMQP.Tx.SelectOk
* @return a transaction-selection method to indicate the transaction was successfully initiated
* @throws java.io.IOException if an error is encountered
*/
Tx.SelectOk txSelect() throws IOException; /**
* Commits a TX transaction on this channel.
* @see com.rabbitmq.client.AMQP.Tx.Commit
* @see com.rabbitmq.client.AMQP.Tx.CommitOk
* @return a transaction-commit method to indicate the transaction was successfully committed
* @throws java.io.IOException if an error is encountered
*/
Tx.CommitOk txCommit() throws IOException; /**
* Rolls back a TX transaction on this channel.
* @see com.rabbitmq.client.AMQP.Tx.Rollback
* @see com.rabbitmq.client.AMQP.Tx.RollbackOk
* @return a transaction-rollback method to indicate the transaction was successfully rolled back
* @throws java.io.IOException if an error is encountered
*/
Tx.RollbackOk txRollback() throws IOException; /**
* Enables publisher acknowledgements on this channel.
* @see com.rabbitmq.client.AMQP.Confirm.Select
* @throws java.io.IOException if an error is encountered
*/
Confirm.SelectOk confirmSelect() throws IOException; /**
* When in confirm mode, returns the sequence number of the next
* message to be published.
* @return the sequence number of the next message to be published
*/
long getNextPublishSeqNo(); /**
* 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.
* @return whether all the messages were ack'd (and none were nack'd)
*/
boolean waitForConfirms() throws InterruptedException; /**
* 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 returns true
* immediately.
* @return whether all the messages were ack'd (and none were nack'd)
*/
boolean waitForConfirms(long timeout) throws InterruptedException, TimeoutException; /** 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. */
void waitForConfirmsOrDie() throws IOException, InterruptedException; /** 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
* return immediately. */
void waitForConfirmsOrDie(long timeout) throws IOException, InterruptedException, TimeoutException; /**
* Asynchronously send a method over this channel.
* @param method method to transmit over this channel.
* @throws IOException Problem transmitting method.
*/
void asyncRpc(Method method) throws IOException; /**
* Synchronously send a method over this channel.
* @param method method to transmit over this channel.
* @return command response to method. Caller should cast as appropriate.
* @throws IOException Problem transmitting method.
*/
Command rpc(Method method) throws IOException;
}

RabbitMQ中客户端的Channel类里各方法释义的更多相关文章

  1. Java中Date和Calender类的使用方法

    查看文章     Java中Date和Calender类的使用方法 2009-10-04 20:49 Date和Calendar是Java类库里提供对时间进行处理的类,由于日期在商业逻辑的应用中占据着 ...

  2. Python的Django框架中forms表单类的使用方法详解

    用户表单是Web端的一项基本功能,大而全的Django框架中自然带有现成的基础form对象,本文就Python的Django框架中forms表单类的使用方法详解. Form表单的功能 自动生成HTML ...

  3. Spring中的@Transactional 放在 类级别 和 方法级别 上有什么不同?

    Spring中的@Transactional 放在类级别 和 方法级别 上有什么不同? @Transactional放在类级别上是否等同于该类的每个方法都放上了@Transactional? 是的一般 ...

  4. RabbitMQ 中 Connection 和 Channel 详解

    我们知道无论是生产者还是消费者,都需要和 RabbitMQ Broker 建立连接,这个连接就是一条 TCP 连接,也就是 Connection. 一旦 TCP 连接建立起来,客户端紧接着可以创建一个 ...

  5. VS2010 MFC中 在FormView派生类里获取文档类指针的方法

    经过苦苦调试,今晚终于解决了一个大问题. 我想要实现的是:在一个FormView的派生类里获取到文档类的指针. 但是出现问题:试了很多办法,始终无法获取到. 终于,此问题在我不懈地调试加尝试下解决了. ...

  6. Appium自动化(13) - 详解 Keyboard 类里的方法和源码分析

    如果你还想从头学起Appium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1693896.html 前言 Keyboard  类在 a ...

  7. Appium自动化(11) - 详解 Applications 类里的方法和源码解析

    如果你还想从头学起Appium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1693896.html 前言 Applications 类 ...

  8. Appium自动化(12) - 详解 HardwareActions 类里的方法和源码分析

    如果你还想从头学起Appium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1693896.html 前言 HardwareAction ...

  9. java中的对象,类。与 方法的重载。

    对象: 一切皆为对象.对象包括两部分内容:属性(名词形容词),行为(动词).对象和对象之间是有关系的: 派生,关联,依赖. 类: 对同一类别的众多对象的一种抽象.类,还是用来生成对象的一种模板,对象是 ...

随机推荐

  1. Linux 系统管理

  2. Springboot实体类转JSON报错Could not find acceptable representation & 设置访问项目根路径的默认欢迎页面

    =================实体类转JSON报错的解决办法============= 之前在springmvc的时候也报过这个错,原因以及springmvc中解决办法参考:https://www ...

  3. 使用ENCKEYS方法加密数据

    要使用这种数据加密方法,您需要配置Oracle GoldenGate以生成加密密钥并将密钥存储在本地ENCKEYS文件中.此方法使用的永久密钥只能通过根据使用加密密钥填充ENCKEYS文件中的说明重新 ...

  4. CF1091F New Year and the Mallard Expedition

    题目地址:CF1091F New Year and the Mallard Expedition 题意比较复杂,整理一下: \(n\) 段,每段有两个属性:长度,地形(G,W,L) 有三种运动方式: ...

  5. Python-eval()函数

    python eval() eval(expression, globals= None, locals= None) --官方文档中的解释: 将字符串str当成有效的表达式子来求值并返回计算结果. ...

  6. JavaScript数组去重—ES6的两种方式

    说明 JavaScript数组去重这个问题,经常出现在面试题中,以前也写过一篇数组去重的文章,(JavaScript 数组去重的多种方法原理详解)但感觉代码还是有点不够简单,今天和大家再说两种方法,代 ...

  7. ESXI常用命令

    1.简介 VMware vSphere ESXi6.0常用命令使用,对于一些个人认为比较常用的命令进行总结,如果读者需要了解更多请访问VMware官网下载文档,链接如下:https://www.vmw ...

  8. ansible笔记(6):常用模块之命令类模块

    ansible笔记():常用模块之命令类模块 command模块 command模块可以帮助我们在远程主机上执行命令 注意:使用command模块在远程主机中执行命令时,不会经过远程主机的shell处 ...

  9. Light OJ 1011

    题意: (好难看) 给你 N 个 男的, 女的, 男的选女票, 题目给出矩阵, Mp[i][j] 表示 第 i 个男的选 第 J 个女的优先值 选了 J 之后的就不能选 J 了: 求所有狗男女的最大优 ...

  10. CURL错误代码及含义

    https://curl.haxx.se/libcurl/c/libcurl-errors.html NAME libcurl-errors - error codes in libcurl DESC ...