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 2009/12/09 17:40:26 UTC

svn commit: r888869 - in /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp: Connection.cs Protocol/StompWireFormat.cs Session.cs

Author: tabish
Date: Wed Dec  9 16:40:25 2009
New Revision: 888869

URL: http://svn.apache.org/viewvc?rev=888869&view=rev
Log:
Remove sending unsubscribe for connectionId and sessionId as the only unsubscribe in Stomp is for a ConsumerId.

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Session.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs?rev=888869&r1=888868&r2=888869&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs Wed Dec  9 16:40:25 2009
@@ -40,7 +40,6 @@
         private readonly object myLock = new object();
         private bool asyncSend = false;
         private bool alwaysSyncSend = false;
-        private bool asyncClose = true;
         private bool copyMessageOnSend = true;
         private bool connected = false;
         private bool closed = false;
@@ -100,18 +99,6 @@
         }
 
         /// <summary>
-        /// This property indicates whether or not async close is enabled.
-        /// When the connection is closed, it will either send a synchronous
-        /// DisposeOf command to the broker and wait for confirmation (if true),
-        /// or it will send the DisposeOf command asynchronously.
-        /// </summary>
-        public bool AsyncClose
-        {
-            get { return asyncClose; }
-            set { asyncClose = value; }
-        }
-
-        /// <summary>
         /// This property sets the acknowledgment mode for the connection.
         /// The URI parameter connection.ackmode can be set to a string value
         /// that maps to the enumeration value.
@@ -271,7 +258,6 @@
         public ISession CreateSession(AcknowledgementMode sessionAcknowledgementMode)
         {
             SessionInfo info = CreateSessionInfo(sessionAcknowledgementMode);
-            SyncRequest(info, this.RequestTimeout);
             Session session = new Session(this, info, sessionAcknowledgementMode);
 
             // Set properties on session using parameters prefixed with "session."
@@ -329,7 +315,6 @@
 
                     if(connected)
                     {
-                        DisposeOf(ConnectionId);
                         ShutdownInfo shutdowninfo = new ShutdownInfo();
                         transport.Oneway(shutdowninfo);
                     }
@@ -438,37 +423,6 @@
             }
         }
 
-        private void DisposeOf(DataStructure objectId)
-        {
-            try
-            {
-                RemoveInfo command = new RemoveInfo();
-                command.ObjectId = objectId;
-                if(asyncClose)
-                {
-                    Tracer.Info("Asynchronously disposing of Connection.");
-                    if(connected)
-                    {
-                        transport.Oneway(command);
-                    }
-                    Tracer.Info("Oneway command sent to broker.");
-                }
-                else
-                {
-                    // Ensure that the object is disposed to avoid potential race-conditions
-                    // of trying to re-create the same object in the broker faster than
-                    // the broker can dispose of the object.  Allow up to 5 seconds to process.
-                    Tracer.Info("Synchronously disposing of Connection.");
-                    SyncRequest(command, TimeSpan.FromSeconds(5));
-                    Tracer.Info("Synchronously closed Connection.");
-                }
-            }
-            catch // (BrokerException)
-            {
-                // Ignore exceptions while shutting down.
-            }
-        }
-
         protected void CheckConnected()
         {
             if(closed)

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs?rev=888869&r1=888868&r2=888869&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs Wed Dec  9 16:40:25 2009
@@ -31,7 +31,6 @@
     {
         private Encoding encoder = new UTF8Encoding();
         private ITransport transport;
-        private IDictionary consumers = Hashtable.Synchronized(new Hashtable());
 
         public StompWireFormat()
         {
@@ -301,9 +300,6 @@
                 frame.SetProperty("activemq.retroactive", command.Retroactive);
             }
 
-            // TODO - The Session should do this one.
-            consumers[command.ConsumerId] = command.ConsumerId;
-            
             frame.ToStream(dataOut);
         }
 
@@ -321,59 +317,6 @@
                 }                
                 frame.SetProperty("id", StompHelper.ToStomp(consumerId));
                 frame.ToStream(dataOut);
-                consumers.Remove(consumerId);
-            }
-            else if(id is SessionId)
-            {
-                // When a session is removed, it needs to remove it's consumers too.
-                // Find all the consumer that were part of the session.
-                SessionId sessionId = (SessionId) id;
-                ArrayList matches = new ArrayList();
-                foreach (DictionaryEntry entry in consumers)
-                {
-                    ConsumerId t = (ConsumerId) entry.Key;
-                    if( sessionId.ConnectionId==t.ConnectionId && sessionId.Value==t.SessionId )
-                    {
-                        matches.Add(t);
-                    }
-                }
-
-                bool unsubscribedConsumer = false;
-
-                // Un-subscribe them.
-                foreach(ConsumerId consumerId in matches)
-                {
-                    if(command.ResponseRequired)
-                    {
-                        frame.SetProperty("receipt", command.CommandId);
-                    }                
-                    frame.SetProperty("id", StompHelper.ToStomp(consumerId));
-                    frame.ToStream(dataOut);
-                    consumers.Remove(consumerId);
-                    unsubscribedConsumer = true;
-                }
-
-                if(!unsubscribedConsumer && command.ResponseRequired)
-                {
-                    if(command.ResponseRequired)
-                    {
-                        frame.SetProperty("receipt", "ignore:" + command.CommandId);
-                    }                
-                    frame.SetProperty("id", sessionId);
-                    frame.ToStream(dataOut);
-                }
-            }
-            else if(id is ConnectionId)
-            {
-                if(command.ResponseRequired)
-                {
-                    if(command.ResponseRequired)
-                    {
-                        frame.SetProperty("receipt", "ignore:" + command.CommandId);
-                    }   
-                    frame.SetProperty("id", id);
-                    frame.ToStream(dataOut);
-                }
             }
         }
 

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Session.cs?rev=888869&r1=888868&r2=888869&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Session.cs Wed Dec  9 16:40:25 2009
@@ -256,10 +256,6 @@
                 }
                 finally
                 {
-                    // Make sure we attempt to inform the broker this Session is done.
-                    RemoveInfo info = new RemoveInfo();
-                    info.ObjectId = this.info.SessionId;
-                    this.connection.Oneway(info);
                     this.connection = null;
                     this.closed = true;
                     this.closing = false;
@@ -342,7 +338,6 @@
             {
                 producer = new MessageProducer(this, command);
                 producers[producerId] = producer;
-                this.connection.Oneway(command);
             }
             catch(Exception)
             {
@@ -519,7 +514,7 @@
 
         public IMapMessage CreateMapMessage()
         {
-            return ConfigureMessage(new MapMessage()) as IMapMessage;
+            throw new NotSupportedException("No Object Message in Stomp");
         }
 
         public IBytesMessage CreateBytesMessage()
@@ -536,7 +531,7 @@
 
         public IStreamMessage CreateStreamMessage()
         {
-            return ConfigureMessage(new StreamMessage()) as IStreamMessage;
+            throw new NotSupportedException("No Object Message in Stomp");
         }
 
         public IObjectMessage CreateObjectMessage(object body)