You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/12/29 16:58:45 UTC

svn commit: r1053657 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs

Author: tabish
Date: Wed Dec 29 15:58:45 2010
New Revision: 1053657

URL: http://svn.apache.org/viewvc?rev=1053657&view=rev
Log:
Fix the InDoubt case to rollback the active transaction so that the next time a TX is started the Messages will be delivered again.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs?rev=1053657&r1=1053656&r2=1053657&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs Wed Dec 29 15:58:45 2010
@@ -371,18 +371,30 @@ namespace Apache.NMS.ActiveMQ
 
         public void InDoubt(Enlistment enlistment)
         {
-            Tracer.Debug("In doubt notification received");
+            Tracer.Debug("In doubt notification received, Rolling Back TX");
+
+            // Now notify the broker that Rollback should be performed.
+            TransactionInfo info = new TransactionInfo();
+            info.ConnectionId = this.session.Connection.ConnectionId;
+            info.TransactionId = this.transactionId;
 
             try
             {
-                // Now notify the broker that it should forget this TX.
-                TransactionInfo info = new TransactionInfo();
-                info.ConnectionId = this.session.Connection.ConnectionId;
-                info.TransactionId = this.transactionId;
-                info.Type = (int) TransactionType.Forget;
-    
-                //Declare done on the enlistment
+                BeforeEnd();
+
+                info.Type = (int)TransactionType.End;
+                this.connection.SyncRequest(info);
+
+                info.Type = (int)TransactionType.Rollback;
+                this.connection.CheckConnected();
+                this.connection.SyncRequest(info);
+
+                Tracer.Debug("Transaction Rollback Reports Done: ");
+
+                // if server responds that nothing needs to be done, then reply done.
                 enlistment.Done();
+
+                AfterRollback();
             }
             finally
             {