activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r818520 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: Connection.cs MessageProducer.cs OpenWire/OpenWireFormat.cs Session.cs
Date Thu, 24 Sep 2009 15:45:24 GMT
Author: tabish
Date: Thu Sep 24 15:45:23 2009
New Revision: 818520

URL: http://svn.apache.org/viewvc?rev=818520&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-189

Implement usage of the MemoryUsage type in the MessageProducer when the WireFormat version
supports it and a Producer Windows size is specified.  Default the Openwire version to three
now. 

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=818520&r1=818519&r2=818520&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Thu Sep
24 15:45:23 2009
@@ -76,6 +76,24 @@
 		public event ExceptionListener ExceptionListener;
 
 		#region Properties
+        
+        /// <summary>
+        /// This property indicates what version of the Protocol we are using to
+        /// communicate with the Broker, if not set we return the lowest version
+        /// number to indicate we support only the basic command set.
+        /// </summary>        
+        public int ProtocolVersion
+        {
+            get
+            {
+                if(brokerWireFormatInfo != null)
+                {
+                    return brokerWireFormatInfo.Version;
+                }
+                
+                return 1;
+            }
+        }
 
 		/// <summary>
 		/// This property indicates whether or not async send is enabled.
@@ -484,8 +502,8 @@
 		/// <param name="commandTransport">An ITransport</param>
 		/// <param name="command">A  Command</param>
 		protected void OnCommand(ITransport commandTransport, Command command)
-		{
-			if(command is MessageDispatch)
+		{			
+            if(command is MessageDispatch)
 			{
 				DispatchMessage((MessageDispatch) command);
 			}

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs?rev=818520&r1=818519&r2=818520&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
Thu Sep 24 15:45:23 2009
@@ -47,6 +47,13 @@
 			this.session = session;
 			this.info = info;
 			this.RequestTimeout = session.RequestTimeout;
+            
+            // Version Three and higher will send us a ProducerAck, but only if we
+            // have a set producer window size.
+            if( session.Connection.ProtocolVersion >= 3 && info.WindowSize >
0 )
+            {
+                usage = new MemoryUsage( info.WindowSize );
+            }
 		}
 
 		~MessageProducer()
@@ -265,6 +272,8 @@
         
         public void OnProducerAck(ProducerAck ack)
         {
+            Tracer.Debug("Received ProducerAck for Message of Size = {" + ack.Size + "}"
);
+            
             if(this.usage != null)
             {
                 this.usage.DecreaseUsage( ack.Size );

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs?rev=818520&r1=818519&r2=818520&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
Thu Sep 24 15:45:23 2009
@@ -60,7 +60,7 @@
 			PreferedWireFormatInfo.MaxInactivityDuration = 30000;
 			PreferedWireFormatInfo.MaxInactivityDurationInitialDelay = 10000;
 			PreferedWireFormatInfo.CacheSize = 0;
-			PreferedWireFormatInfo.Version = 2;
+			PreferedWireFormatInfo.Version = 3;
 
 			dataMarshallers = new BaseDataStreamMarshaller[256];
 			Version = 1;

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=818520&r1=818519&r2=818520&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 Sep
24 15:45:23 2009
@@ -223,6 +223,9 @@
 
                 throw;
             }
+            
+            // Registered with Connection so it can process Producer Acks.
+            connection.addProducer(producerId, producer);
 
             return producer;
         }
@@ -508,7 +511,7 @@
             
             msg.OnSend();
             msg.ProducerId = msg.MessageId.ProducerId;
-
+            
             if(sendTimeout.TotalMilliseconds <= 0 && !msg.ResponseRequired &&
!connection.AlwaysSyncSend && 
                (!msg.Persistent || connection.AsyncSend || msg.TransactionId != null))
             {
@@ -559,6 +562,7 @@
         public void DisposeOf(ProducerId objectId)
         {
             Connection.DisposeOf(objectId);
+            connection.removeProducer(objectId);
             if(!this.closing)
             {
                 producers.Remove(objectId);



Mime
View raw message