Author: steshaw
Date: Tue Nov 28 15:56:14 2006
New Revision: 480293

URL: http://svn.apache.org/viewvc?view=rev&rev=480293
Log:
QPID-135 Added Rollback support

Modified:
    
incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs
    incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs

Modified: 
incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs?view=diff&rev=480293&r1=480292&r2=480293
==============================================================================
--- 
incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs 
(original)
+++ 
incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs 
Tue Nov 28 15:56:14 2006
@@ -34,7 +34,8 @@
         private static readonly ILog _log = 
LogManager.GetLogger(typeof(FailoverTxTest));
 
         const int NUM_ITERATIONS = 10;
-        const int NUM_MESSAGES = 10;
+        const int NUM_COMMITED_MESSAGES = 10;
+        const int NUM_ROLLEDBACK_MESSAGES = 5;
         const int SLEEP_MILLIS = 500;
 
         AMQConnection _connection;
@@ -92,9 +93,18 @@
 
             for (int i = 1; i <= NUM_ITERATIONS; ++i)
             {
-                for (int j = 1; j <= NUM_MESSAGES; ++j)
+                for (int j = 1; j <= NUM_ROLLEDBACK_MESSAGES; ++j)
                 {
-                    ITextMessage msg = 
publishingChannel.CreateTextMessage("Tx=" + i + " msg=" + j);
+                    ITextMessage msg = 
publishingChannel.CreateTextMessage("Tx=" + i + " rolledBackMsg=" + j);
+                    _log.Info("sending message = " + msg.Text);
+                    publisher.Send(msg);
+                    Thread.Sleep(SLEEP_MILLIS);
+                }
+                if (transacted) publishingChannel.Rollback();
+
+                for (int j = 1; j <= NUM_COMMITED_MESSAGES; ++j)
+                {
+                    ITextMessage msg = 
publishingChannel.CreateTextMessage("Tx=" + i + " commitedMsg=" + j);
                     _log.Info("sending message = " + msg.Text);
                     publisher.Send(msg);
                     Thread.Sleep(SLEEP_MILLIS);

Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs?view=diff&rev=480293&r1=480292&r2=480293
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs Tue Nov 
28 15:56:14 2006
@@ -300,20 +300,15 @@
             CheckNotClosed();
             CheckTransacted(); // throws IllegalOperationException if not a 
transacted session
 
-            /*Channel.Rollback frame = new Channel.Rollback();
-            frame.channelId = _channelId;
-            frame.confirmTag = 1;*/
-
-            //        try
-            //        {
-            //            
_connection.getProtocolHandler().writeCommandFrameAndWaitForReply(frame, new 
ChannelReplyListener(_channelId));
-            //        }
-            //        catch (AMQException e)
-            //        {
-            //            throw new JMSException("Error rolling back session: 
" + e);
-            //        }
-            throw new NotImplementedException();
-            //_logger.Info("Transaction rolled back on channel " + _channelId);
+            try
+            {
+                _connection.ConvenientProtocolWriter.SyncWrite(
+                        TxRollbackBody.CreateAMQFrame(_channelId), 
typeof(TxRollbackOkBody));
+            }
+            catch (AMQException e)
+            {
+                throw new QpidException("Failed to rollback", e);
+            }
         }
 
         public override void Close()


Reply via email to