2009-05-21 Michael Barker <mike@middlesoft.co.uk>
[mono.git] / mcs / class / RabbitMQ.Client / src / client / api / IModel.cs
index 33ed06f3122ae9a6be08b1ed0deff8e9f15ee010..32474899f64cc93a42530c919c2617e08bfa1211 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007, 2008 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //
 //   The Original Code is The RabbitMQ .NET Client.
 //
-//   The Initial Developers of the Original Code are LShift Ltd.,
-//   Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
+//   The Initial Developers of the Original Code are LShift Ltd,
+//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd., Cohesive Financial Technologies
-//   LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007, 2008
-//   LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
-//   Technologies Ltd.;
+//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+//   Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Ltd. Portions created by Cohesive Financial Technologies LLC are
+//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
+//   (C) 2007-2009 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -118,34 +124,6 @@ namespace RabbitMQ.Client
         [return: AmqpFieldMapping(null, "active")]
         void ChannelFlow(bool active);
 
-        ///<summary>(Spec method) Convenience method, asking for
-        ///non-exclusive access to all capabilities within a
-        ///realm.</summary>
-        ///<remarks>
-        ///If Access.Request is disabled, either through the IProtocol
-        ///default or through the AccessRequestConfig property of
-        ///ConnectionParameters, no request is sent to the peer and a
-        ///dummy ticket number is returned.
-        ///</remarks>
-        [AmqpMethodDoNotImplement(null)]
-        ushort AccessRequest(string realm);
-
-        ///<summary>(Spec method) Retrieve an access ticket
-        ///("capability") for a realm.</summary>
-        ///<remarks>
-        ///If Access.Request is disabled, either through the IProtocol
-        ///default or through the AccessRequestConfig property of
-        ///ConnectionParameters, no request is sent to the peer and a
-        ///dummy ticket number is returned.
-        ///</remarks>
-        [AmqpMethodDoNotImplement(null)]
-        ushort AccessRequest(string realm,
-                             bool exclusive,
-                             bool passive,
-                             bool active,
-                             bool write,
-                             bool read);
-
         ///<summary>(Spec method) Declare an exchange.</summary>
         ///<remarks>
         ///The exchange is declared non-passive, non-autodelete, and
@@ -153,7 +131,7 @@ namespace RabbitMQ.Client
         ///exercised.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        void ExchangeDeclare(ushort ticket, string exchange, string type, bool durable);
+        void ExchangeDeclare(string exchange, string type, bool durable);
 
         ///<summary>(Spec method) Declare an exchange.</summary>
         ///<remarks>
@@ -162,11 +140,10 @@ namespace RabbitMQ.Client
         ///exercised.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        void ExchangeDeclare(ushort ticket, string exchange, string type);
+        void ExchangeDeclare(string exchange, string type);
 
         ///<summary>(Spec method) Declare an exchange.</summary>
-        void ExchangeDeclare(ushort ticket,
-                             string exchange,
+        void ExchangeDeclare(string exchange,
                              string type,
                              bool passive,
                              bool durable,
@@ -177,8 +154,7 @@ namespace RabbitMQ.Client
                              IDictionary arguments);
 
         ///<summary>(Spec method) Delete an exchange.</summary>
-        void ExchangeDelete(ushort ticket,
-                            string exchange,
+        void ExchangeDelete(string exchange,
                             bool ifUnused,
                             [AmqpNowaitArgument(null)]
                             bool nowait);
@@ -191,7 +167,7 @@ namespace RabbitMQ.Client
         ///name is the return value of this method.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string QueueDeclare(ushort ticket);
+        string QueueDeclare();
 
         ///<summary>(Spec method) Declare a queue.</summary>
         ///<remarks>
@@ -199,8 +175,7 @@ namespace RabbitMQ.Client
         ///non-exclusive, and non-autodelete, with no arguments.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string QueueDeclare(ushort ticket,
-                            string queue);
+        string QueueDeclare(string queue);
 
         ///<summary>(Spec method) Declare a queue.</summary>
         ///<remarks>
@@ -208,8 +183,7 @@ namespace RabbitMQ.Client
         ///non-autodelete, with no arguments.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string QueueDeclare(ushort ticket,
-                            string queue,
+        string QueueDeclare(string queue,
                             bool durable);
 
         ///<summary>(Spec method) Declare a queue.</summary>
@@ -217,8 +191,7 @@ namespace RabbitMQ.Client
         ///Returns the name of the queue that was declared.
         ///</remarks>
         [return: AmqpFieldMapping(null, "queue")]
-        string QueueDeclare(ushort ticket,
-                            string queue,
+        string QueueDeclare(string queue,
                             bool passive,
                             bool durable,
                             bool exclusive,
@@ -228,8 +201,7 @@ namespace RabbitMQ.Client
                             IDictionary arguments);
 
         ///<summary>(Spec method) Bind a queue to an exchange.</summary>
-        void QueueBind(ushort ticket,
-                       string queue,
+        void QueueBind(string queue,
                        string exchange,
                        string routingKey,
                        [AmqpNowaitArgument(null)]
@@ -239,12 +211,12 @@ namespace RabbitMQ.Client
         ///<summary>(Spec method) Unbind a queue from an exchange.</summary>
         ///<remarks>
         ///Note: This operation is only supported when communicating
-        ///using AMQP protocol version 0-9.
+        ///using AMQP protocol version 0-9, or when communicating with
+        ///a 0-8 broker that has been enhanced with the unofficial
+        ///addition of a queue.unbind method.
         ///</remarks>
-        [AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
         [AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
-        void QueueUnbind(ushort ticket,
-                         string queue,
+        void QueueUnbind(string queue,
                          string exchange,
                          string routingKey,
                          IDictionary arguments);
@@ -255,8 +227,7 @@ namespace RabbitMQ.Client
         ///specified, returns <code>uint.MaxValue</code>.
         ///</remarks>
         [return: AmqpFieldMapping(null, "messageCount")]
-        uint QueuePurge(ushort ticket,
-                        string queue,
+        uint QueuePurge(string queue,
                         [AmqpNowaitArgument(null, "0xFFFFFFFF")]
                         bool nowait);
 
@@ -267,8 +238,7 @@ namespace RabbitMQ.Client
         ///<code>uint.MaxValue</code>.
         ///</remarks>
         [return: AmqpFieldMapping(null, "messageCount")]
-        uint QueueDelete(ushort ticket,
-                         string queue,
+        uint QueueDelete(string queue,
                          bool ifUnused,
                          bool ifEmpty,
                          [AmqpNowaitArgument(null, "0xFFFFFFFF")]
@@ -281,8 +251,7 @@ namespace RabbitMQ.Client
         ///noLocal=false and exclusive=false.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string BasicConsume(ushort ticket,
-                            string queue,
+        string BasicConsume(string queue,
                             IDictionary filter,
                             IBasicConsumer consumer);
 
@@ -293,8 +262,7 @@ namespace RabbitMQ.Client
         ///noLocal=false and exclusive=false.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string BasicConsume(ushort ticket,
-                            string queue,
+        string BasicConsume(string queue,
                             bool noAck,
                             IDictionary filter,
                             IBasicConsumer consumer);
@@ -305,8 +273,7 @@ namespace RabbitMQ.Client
         ///noLocal=false and exclusive=false.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        string BasicConsume(ushort ticket,
-                            string queue,
+        string BasicConsume(string queue,
                             bool noAck,
                             string consumerTag,
                             IDictionary filter,
@@ -314,8 +281,7 @@ namespace RabbitMQ.Client
 
         ///<summary>Start a Basic content-class consumer.</summary>
         [AmqpMethodDoNotImplement(null)]
-        string BasicConsume(ushort ticket,
-                            string queue,
+        string BasicConsume(string queue,
                             bool noAck,
                             string consumerTag,
                             bool noLocal,
@@ -337,8 +303,7 @@ namespace RabbitMQ.Client
         ///The publication occurs with mandatory=false and immediate=false.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        void BasicPublish(ushort ticket,
-                          PublicationAddress addr,
+        void BasicPublish(PublicationAddress addr,
                           IBasicProperties basicProperties,
                           byte[] body);
 
@@ -347,8 +312,7 @@ namespace RabbitMQ.Client
         ///The publication occurs with mandatory=false and immediate=false.
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
-        void BasicPublish(ushort ticket,
-                          string exchange,
+        void BasicPublish(string exchange,
                           string routingKey,
                           IBasicProperties basicProperties,
                           byte[] body);
@@ -356,8 +320,7 @@ namespace RabbitMQ.Client
         ///<summary>(Spec method) Publish a message using the Basic
         ///content-class.</summary>
         [AmqpMethodDoNotImplement(null)]
-        void BasicPublish(ushort ticket,
-                          string exchange,
+        void BasicPublish(string exchange,
                           string routingKey,
                           bool mandatory,
                           bool immediate,
@@ -380,8 +343,7 @@ namespace RabbitMQ.Client
         ///no messages are currently available. See also
         ///IModel.BasicAck.</summary>
         [AmqpMethodDoNotImplement(null)]
-        BasicGetResult BasicGet(ushort ticket,
-                                string queue,
+        BasicGetResult BasicGet(string queue,
                                 bool noAck);
 
         ///<summary>(Spec method) Enable TX mode for this session.</summary>
@@ -403,13 +365,55 @@ namespace RabbitMQ.Client
 
         ///<summary>Close this session.</summary>
         ///<remarks>
-        /// If the session is already closed (or closing), then this
-        /// method does nothing but wait for the in-progress close
-        /// operation to complete. This method will not return to the
-        /// caller until the shutdown is complete.
+        ///If the session is already closed (or closing), then this
+        ///method does nothing but wait for the in-progress close
+        ///operation to complete. This method will not return to the
+        ///caller until the shutdown is complete.
+        ///</remarks>
+        [AmqpMethodDoNotImplement(null)]
+        void Close();
+        
+        ///<summary>Close this session.</summary>
+        ///<remarks>
+        ///The method behaves in the same way as Close(), with the only
+        ///difference that the model is closed with the given model
+        ///close code and message.
+        ///<para>
+        ///The close code (See under "Reply Codes" in the AMQP specification)
+        ///</para>
+        ///<para>
+        ///A message indicating the reason for closing the model
+        ///</para>
         ///</remarks>
         [AmqpMethodDoNotImplement(null)]
         void Close(ushort replyCode, string replyText);
+        
+        ///<summary>Abort this session.</summary>
+        ///<remarks>
+        ///If the session is already closed (or closing), then this
+        ///method does nothing but wait for the in-progress close
+        ///operation to complete. This method will not return to the
+        ///caller until the shutdown is complete.
+        ///In comparison to normal Close() method, Abort() will not throw
+        ///AlreadyClosedException or IOException during closing model.
+        ///</remarks>
+        [AmqpMethodDoNotImplement(null)]
+        void Abort();
+        
+        ///<summary>Abort this session.</summary>
+        ///<remarks>
+        ///The method behaves in the same way as Abort(), with the only
+        ///difference that the model is closed with the given model
+        ///close code and message.
+        ///<para>
+        ///The close code (See under "Reply Codes" in the AMQP specification)
+        ///</para>
+        ///<para>
+        ///A message indicating the reason for closing the model
+        ///</para>
+        ///</remarks>
+        [AmqpMethodDoNotImplement(null)]
+        void Abort(ushort replyCode, string replyText);
     }
 
     ///<summary>Represents Basic.GetOk responses from the server.</summary>
@@ -490,25 +494,11 @@ namespace RabbitMQ.Client.Impl
     ///<see cref="RabbitMQ.Client.Framing.Impl.v0_9.Model"/>
     public interface IFullModel : RabbitMQ.Client.IModel
     {
-        ///<summary>Used to send an Access.Request method. Called by
-        ///the public API after checking whether our peer's
-        ///implementation can actually handle access
-        ///requests.</summary>
-        [AmqpMethodMapping(null, "access", "request")]
-        [return: AmqpFieldMapping(null, "ticket")]
-        ushort _Private_AccessRequest(string realm,
-                      bool exclusive,
-                      bool passive,
-                      bool active,
-                      bool write,
-                      bool read);
-
         ///<summary>Used to send a Basic.Publish method. Called by the
         ///public publish method after potential null-reference issues
         ///have been rectified.</summary>
         [AmqpMethodMapping(null, "basic", "publish")]
-        void _Private_BasicPublish(ushort ticket,
-                                   string exchange,
+        void _Private_BasicPublish(string exchange,
                                    string routingKey,
                                    bool mandatory,
                                    bool immediate,
@@ -522,8 +512,7 @@ namespace RabbitMQ.Client.Impl
         ///datastructures.</summary>
         [AmqpForceOneWay]
         [AmqpMethodMapping(null, "basic", "consume")]
-        void _Private_BasicConsume(ushort ticket,
-                                   string queue,
+        void _Private_BasicConsume(string queue,
                                    string consumerTag,
                                    bool noLocal,
                                    bool noAck,
@@ -573,8 +562,7 @@ namespace RabbitMQ.Client.Impl
         ///required.</summary>
         [AmqpForceOneWay]
         [AmqpMethodMapping(null, "basic", "get")]
-        void _Private_BasicGet(ushort ticket,
-                               string queue,
+        void _Private_BasicGet(string queue,
                                bool noAck);
 
         ///<summary>Handle incoming Basic.GetOk methods. Routes the
@@ -620,6 +608,15 @@ namespace RabbitMQ.Client.Impl
                                IBasicProperties basicProperties,
                                [AmqpContentBodyMapping]
                                byte[] body);
+                               
+        ///<summary>Used to send a Channel.FlowOk. Confirms that
+        ///Channel.Flow from the broker was processed.</summary>
+        [AmqpMethodMapping(null, "channel", "flow-ok")]
+        void _Private_ChannelFlowOk();
+        
+        ///<summary>Handle incoming Channel.Flow methods. Either
+        ///stops or resumes sending the methods that have content.</summary>
+        void HandleChannelFlow(bool active);
 
         ///<summary>Handle an incoming Channel.Close. Shuts down the
         ///session and model.</summary>