activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1061835 - /activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs
Date Fri, 21 Jan 2011 15:03:17 GMT
Author: tabish
Date: Fri Jan 21 15:03:17 2011
New Revision: 1061835

URL: http://svn.apache.org/viewvc?rev=1061835&view=rev
Log:
Merge from trunk

fix for: https://issues.apache.org/jira/browse/AMQNET-308
fix for: https://issues.apache.org/jira/browse/AMQNET-307

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs?rev=1061835&r1=1061834&r2=1061835&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Protocol/StompWireFormat.cs
Fri Jan 21 15:03:17 2011
@@ -32,6 +32,7 @@ namespace Apache.NMS.Stomp.Protocol
         private IPrimitiveMapMarshaler mapMarshaler = new XmlPrimitiveMapMarshaler();
         private ITransport transport;
         private WireFormatInfo remoteWireFormatInfo;
+        private int connectedResponseId = -1;
 
         public StompWireFormat()
         {
@@ -190,8 +191,6 @@ namespace Apache.NMS.Stomp.Protocol
 
         protected virtual Command ReadConnected(StompFrame frame)
         {
-            string responseId = frame.RemoveProperty("response-id");
-
             this.remoteWireFormatInfo = new WireFormatInfo();
 
             if(frame.HasProperty("version"))
@@ -222,11 +221,16 @@ namespace Apache.NMS.Stomp.Protocol
                 remoteWireFormatInfo.Version = 1.0f;
             }
 
-            if(responseId != null)
+            if(this.connectedResponseId != -1)
             {
                 Response answer = new Response();
-                answer.CorrelationId = Int32.Parse(responseId);
+                answer.CorrelationId = this.connectedResponseId;
                 SendCommand(answer);
+                this.connectedResponseId = -1;
+            }
+            else
+            {
+                throw new IOException("Received Connected Frame without a set Response Id
for it.");
             }
 
             return remoteWireFormatInfo;
@@ -421,6 +425,7 @@ namespace Apache.NMS.Stomp.Protocol
             }   
 
             frame.SetProperty("message-id", command.LastMessageId.ToString());
+            frame.SetProperty("subscription", command.ConsumerId.ToString());
 
             if(command.TransactionId != null)
             {
@@ -442,9 +447,14 @@ namespace Apache.NMS.Stomp.Protocol
             StompFrame frame = new StompFrame("CONNECT");
 
             frame.SetProperty("client-id", command.ClientId);
-            frame.SetProperty("login", command.UserName);
-            frame.SetProperty("passcode", command.Password);
-            frame.SetProperty("request-id", command.CommandId);
+            if(!String.IsNullOrEmpty(command.UserName))
+            {
+                frame.SetProperty("login", command.UserName);
+            }
+            if(!String.IsNullOrEmpty(command.Password))
+            {
+                frame.SetProperty("passcode", command.Password);
+            }
             frame.SetProperty("host", command.Host);
             frame.SetProperty("accept-version", "1.0,1.1");
 
@@ -458,6 +468,8 @@ namespace Apache.NMS.Stomp.Protocol
                 Tracer.Debug("StompWireFormat - Writing " + frame.ToString());
             }
 
+            this.connectedResponseId = command.CommandId;
+
             frame.ToStream(dataOut);
         }
 



Mime
View raw message