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 2013/05/16 23:51:51 UTC

svn commit: r1483583 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk: src/main/csharp/MessageConsumer.cs src/main/csharp/NetTxSession.cs src/main/csharp/Session.cs vs2008-activemq.csproj

Author: tabish
Date: Thu May 16 21:51:51 2013
New Revision: 1483583

URL: http://svn.apache.org/r1483583
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-419

Begins to partition the DTC ugliness into a NetTXMessageConsumer so we don't have to impact performance of the non-DTC consumer in order to deal with all DTC's issues. 

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxSession.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=1483583&r1=1483582&r2=1483583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs Thu May 16 21:51:51 2013
@@ -1819,7 +1819,7 @@ namespace Apache.NMS.ActiveMQ
 			}
 		}
 
-		class ConsumerCloseSynchronization : ISynchronization
+		protected class ConsumerCloseSynchronization : ISynchronization
 		{
 			private readonly MessageConsumer consumer;
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxSession.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxSession.cs?rev=1483583&r1=1483582&r2=1483583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxSession.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxSession.cs Thu May 16 21:51:51 2013
@@ -96,6 +96,14 @@ namespace Apache.NMS.ActiveMQ
             }
         }
 
+        internal override MessageConsumer DoCreateMessageConsumer(
+            ConsumerId id, ActiveMQDestination destination, string name, string selector,
+            int prefetch, int maxPending, bool noLocal)
+        {
+            return new NetTxMessageConsumer(this, id, destination, name, selector, prefetch,
+                                            maxPending, noLocal, false, this.DispatchAsync);
+        }
+
         internal override void DoRollback()
         {
             // Only the Transaction Manager can do this when in a .NET Transaction.

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=1483583&r1=1483582&r2=1483583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Thu May 16 21:51:51 2013
@@ -437,7 +437,7 @@ namespace Apache.NMS.ActiveMQ
                     dest = ActiveMQDestination.Transform(destination);
                 }
 
-                producer = new MessageProducer(this, GetNextProducerId(), dest, this.RequestTimeout);
+                producer = DoCreateMessageProducer(GetNextProducerId(), dest);
 
                 producer.ProducerTransformer = this.ProducerTransformer;
 
@@ -458,6 +458,11 @@ namespace Apache.NMS.ActiveMQ
             return producer;
         }
 
+        internal virtual MessageProducer DoCreateMessageProducer(ProducerId id, ActiveMQDestination destination)
+        {
+            return new MessageProducer(this, GetNextProducerId(), destination, this.RequestTimeout);
+        }
+
         public IMessageConsumer CreateConsumer(IDestination destination)
         {
             return CreateConsumer(destination, null, false);
@@ -478,11 +483,11 @@ namespace Apache.NMS.ActiveMQ
             ActiveMQDestination dest = ActiveMQDestination.Transform(destination);
             int prefetchSize = this.Connection.PrefetchPolicy.DurableTopicPrefetch;
 
-            if(dest is ITopic || dest is ITemporaryTopic)
+            if(dest.IsTopic)
             {
                 prefetchSize = this.connection.PrefetchPolicy.TopicPrefetch;
             }
-            else if(dest is IQueue || dest is ITemporaryQueue)
+            else if(dest.IsQueue)
             {
                 prefetchSize = this.connection.PrefetchPolicy.QueuePrefetch;
             }
@@ -491,9 +496,9 @@ namespace Apache.NMS.ActiveMQ
 
             try
             {
-                consumer = new MessageConsumer(this, GetNextConsumerId(), dest, null, selector, prefetchSize,
-                                               this.connection.PrefetchPolicy.MaximumPendingMessageLimit,
-                                               noLocal, false, this.connection.DispatchAsync);
+                consumer = DoCreateMessageConsumer(GetNextConsumerId(), dest, null, selector, prefetchSize,
+                                                   this.connection.PrefetchPolicy.MaximumPendingMessageLimit,
+                                                   noLocal);
 
                 consumer.ConsumerTransformer = this.ConsumerTransformer;
 
@@ -531,10 +536,10 @@ namespace Apache.NMS.ActiveMQ
 
             try
             {
-                consumer = new MessageConsumer(this, GetNextConsumerId(), dest, name, selector,
-                                               this.connection.PrefetchPolicy.DurableTopicPrefetch,
-                                               this.connection.PrefetchPolicy.MaximumPendingMessageLimit,
-                                               noLocal, false, this.connection.DispatchAsync);
+                consumer = DoCreateMessageConsumer(GetNextConsumerId(), dest, name, selector, 
+                                                   this.connection.PrefetchPolicy.DurableTopicPrefetch,
+                                                   this.connection.PrefetchPolicy.MaximumPendingMessageLimit,
+                                                   noLocal);
 
                 consumer.ConsumerTransformer = this.ConsumerTransformer;
 
@@ -560,6 +565,14 @@ namespace Apache.NMS.ActiveMQ
             return consumer;
         }
 
+        internal virtual MessageConsumer DoCreateMessageConsumer(
+            ConsumerId id, ActiveMQDestination destination, string name, string selector, 
+            int prefetch, int maxPending, bool noLocal)
+        {
+            return new MessageConsumer(this, id, destination, name, selector, prefetch,
+                                       maxPending, noLocal, false, this.DispatchAsync);
+        }
+
         public void DeleteDurableConsumer(string name)
         {
             RemoveSubscriptionInfo command = new RemoveSubscriptionInfo();

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj?rev=1483583&r1=1483582&r2=1483583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj Thu May 16 21:51:51 2013
@@ -65,8 +65,10 @@
       <HintPath>lib\DotNetZip\net-2.0\Ionic.Zlib.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Data" />
     <Reference Include="System.Transactions" />
     <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="src\main\csharp\AdvisoryConsumer.cs" />
@@ -313,6 +315,7 @@
     </Compile>
     <Compile Include="src\main\csharp\NetTxConnection.cs" />
     <Compile Include="src\main\csharp\NetTxConnectionFactory.cs" />
+    <Compile Include="src\main\csharp\NetTxMessageConsumer.cs" />
     <Compile Include="src\main\csharp\NetTxRecoveryPolicy.cs" />
     <Compile Include="src\main\csharp\NetTxSession.cs" />
     <Compile Include="src\main\csharp\OpenWire\BaseDataStreamMarshaller.cs">