Merge from trunk fix for: https://issues.apache.org/jira/browse/AMQNET-308 fix for: https://issues.apache.org/jira/browse/AMQNET-307
Project: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/commit/196ee4bb Tree: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/tree/196ee4bb Diff: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/diff/196ee4bb Branch: refs/heads/1.5.x Commit: 196ee4bb0ade61f14434e91a418c58224935bc37 Parents: 9ece124 Author: Timothy A. Bish <tab...@apache.org> Authored: Fri Jan 21 15:03:17 2011 +0000 Committer: Timothy A. Bish <tab...@apache.org> Committed: Fri Jan 21 15:03:17 2011 +0000 ---------------------------------------------------------------------- src/main/csharp/Protocol/StompWireFormat.cs | 26 +++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/196ee4bb/src/main/csharp/Protocol/StompWireFormat.cs ---------------------------------------------------------------------- diff --git a/src/main/csharp/Protocol/StompWireFormat.cs b/src/main/csharp/Protocol/StompWireFormat.cs index 5554e19..6b864f7 100644 --- a/src/main/csharp/Protocol/StompWireFormat.cs +++ b/src/main/csharp/Protocol/StompWireFormat.cs @@ -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); }