Merge pull request #23 from lukeabsent/AMQNET-637

AMQNET-637 NMS 2.0 More async methods - few additional methods/updates
diff --git a/src/nms-api/IMessage.cs b/src/nms-api/IMessage.cs
index b20f9dd..5b7053b 100644
--- a/src/nms-api/IMessage.cs
+++ b/src/nms-api/IMessage.cs
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Threading.Tasks;
 
 namespace Apache.NMS
 {
@@ -29,6 +30,12 @@
         /// message has been processed correctly.
         /// </summary>
         void Acknowledge();
+        
+        /// <summary>
+        /// If using client acknowledgement mode on the session, then this method will acknowledge that the
+        /// message has been processed correctly.
+        /// </summary>
+        Task AcknowledgeAsync();
 
         /// <summary>
         /// Clears out the message body. Clearing a message's body does not clear its header
diff --git a/src/nms-api/INMSContext.cs b/src/nms-api/INMSContext.cs
index 5be6317..a84d8b0 100644
--- a/src/nms-api/INMSContext.cs
+++ b/src/nms-api/INMSContext.cs
@@ -324,7 +324,7 @@
 
         /// <summary>
         /// Stops all Message delivery in this session and restarts it again
-        /// with the oldest unabcknowledged message.  Messages that were delivered
+        /// with the oldest unacknowledged message.  Messages that were delivered
         /// but not acknowledge should have their redelivered property set.
         /// This is an optional method that may not by implemented by all NMS
         /// providers, if not implemented an Exception will be thrown.
@@ -332,8 +332,21 @@
         /// order.  It is not valid to call this method on a Transacted Session.
         /// </summary>
         void Recover();
+        
+        /// <summary>
+        /// Stops all Message delivery in this session and restarts it again
+        /// with the oldest unacknowledged message.  Messages that were delivered
+        /// but not acknowledge should have their redelivered property set.
+        /// This is an optional method that may not by implemented by all NMS
+        /// providers, if not implemented an Exception will be thrown.
+        /// Message redelivery is not requried to be performed in the original
+        /// order.  It is not valid to call this method on a Transacted Session.
+        /// </summary>
+        Task RecoverAsync();
 
         void Acknowledge();
+        
+        Task AcknowledgeAsync();
 
         #region Transaction methods
 
@@ -342,12 +355,24 @@
         /// send and acknowledgements for producers and consumers in this session
         /// </summary>
         void Commit();
+        
+        /// <summary>
+        /// If this is a transactional session then commit all message
+        /// send and acknowledgements for producers and consumers in this session
+        /// </summary>
+        Task CommitAsync();
 
         /// <summary>
         /// If this is a transactional session then rollback all message
         /// send and acknowledgements for producers and consumers in this session
         /// </summary>
-        void Rollback();
+        void Rollback(); 
+        
+        /// <summary>
+        /// If this is a transactional session then rollback all message
+        /// send and acknowledgements for producers and consumers in this session
+        /// </summary>
+        Task RollbackAsync();
 
         #endregion
 
diff --git a/src/nms-api/ISession.cs b/src/nms-api/ISession.cs
index 59e29f8..a0ec056 100644
--- a/src/nms-api/ISession.cs
+++ b/src/nms-api/ISession.cs
@@ -346,7 +346,7 @@
 
         /// <summary>
         /// Stops all Message delivery in this session and restarts it again
-        /// with the oldest unabcknowledged message.  Messages that were delivered
+        /// with the oldest unacknowledged message.  Messages that were delivered
         /// but not acknowledge should have their redelivered property set.
         /// This is an optional method that may not by implemented by all NMS
         /// providers, if not implemented an Exception will be thrown.
@@ -354,8 +354,21 @@
         /// order.  It is not valid to call this method on a Transacted Session.
         /// </summary>
         void Recover();
+        
+        /// <summary>
+        /// Stops all Message delivery in this session and restarts it again
+        /// with the oldest unacknowledged message.  Messages that were delivered
+        /// but not acknowledge should have their redelivered property set.
+        /// This is an optional method that may not by implemented by all NMS
+        /// providers, if not implemented an Exception will be thrown.
+        /// Message redelivery is not requried to be performed in the original
+        /// order.  It is not valid to call this method on a Transacted Session.
+        /// </summary>
+        Task RecoverAsync();
 
         void Acknowledge();
+        
+        Task AcknowledgeAsync();
 
         #region Transaction methods
 
diff --git a/src/nms-api/ITemporaryQueue.cs b/src/nms-api/ITemporaryQueue.cs
index 5950841..9825064 100644
--- a/src/nms-api/ITemporaryQueue.cs
+++ b/src/nms-api/ITemporaryQueue.cs
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+using System.Threading.Tasks;
+
 namespace Apache.NMS
 {
     /// <summary>
@@ -32,5 +34,15 @@
         /// not support this operation.
         /// </exception>
         void Delete();
-    }
+        
+        /// <summary>
+        /// Deletes this Temporary Destination, If there are existing receivers 
+        /// still using it, a NMSException will be thrown.
+        /// </summary>
+        /// <exception cref="Apache.NMS.NMSException">
+        /// If NMS Provider fails to Delete the Temp Destination or the client does
+        /// not support this operation.
+        /// </exception>
+        Task DeleteAsync();
+    } 
 }
\ No newline at end of file
diff --git a/src/nms-api/ITemporaryTopic.cs b/src/nms-api/ITemporaryTopic.cs
index c942ddc..9734432 100644
--- a/src/nms-api/ITemporaryTopic.cs
+++ b/src/nms-api/ITemporaryTopic.cs
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+using System.Threading.Tasks;
+
 namespace Apache.NMS
 {
     /// <summary>
@@ -32,5 +34,15 @@
         /// not support this operation.
         /// </exception>
         void Delete();
+        
+        /// <summary>
+        /// Deletes this Temporary Destination, If there are existing receivers 
+        /// still using it, a NMSException will be thrown.
+        /// </summary>
+        /// <exception cref="Apache.NMS.NMSException">
+        /// If NMS Provider fails to Delete the Temp Destination or the client does
+        /// not support this operation.
+        /// </exception>
+        Task DeleteAsync();
     }
 }
\ No newline at end of file
diff --git a/test/nms-api-test/Commands/Message.cs b/test/nms-api-test/Commands/Message.cs
index 06342cd..5edc461 100644
--- a/test/nms-api-test/Commands/Message.cs
+++ b/test/nms-api-test/Commands/Message.cs
@@ -17,6 +17,7 @@
 
 using System;
 using System.Collections;
+using System.Threading.Tasks;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.Commands
@@ -92,6 +93,11 @@
         {
         }
 
+        public Task AcknowledgeAsync()
+        {
+            return Task.Factory.StartNew(Acknowledge);
+        }
+
         public virtual void ClearBody()
         {
             this.content = null;
diff --git a/test/nms-api-test/Commands/TempDestination.cs b/test/nms-api-test/Commands/TempDestination.cs
index 2d829b4..d20d220 100644
--- a/test/nms-api-test/Commands/TempDestination.cs
+++ b/test/nms-api-test/Commands/TempDestination.cs
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Threading.Tasks;
 
 namespace Apache.NMS.Commands
 {
@@ -58,6 +59,11 @@
             return o;
         }
 
+        public Task DeleteAsync()
+        {
+            return Task.Factory.StartNew(Delete);
+        }
+
         public void Delete()
         {
             throw new NotSupportedException("Stomp Cannot Delete Temporary Destinations");