Author: jgomes
Date: Tue Dec  9 10:56:14 2008
New Revision: 724827

URL: http://svn.apache.org/viewvc?rev=724827&view=rev
Log:
Add support in ISession to delete destinations, both temporary and standard.  
This allows for deterministic deletion of destinations without having to close 
a connection to get temporary destinations to be deleted.
Fixes [AMQNET-129] and AMQNET-129].
(See https://issues.apache.org/activemq/browse/AMQNET-129)
(See https://issues.apache.org/activemq/browse/AMQNET-123)

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs?rev=724827&r1=724826&r2=724827&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs
 Tue Dec  9 10:56:14 2008
@@ -36,7 +36,7 @@
                public const byte REMOVE_OPERATION_TYPE = 1;
 
                ConnectionId connectionId;
-               ActiveMQDestination destination;
+               IDestination destination;
                byte operationType;
                long timeout;
                BrokerId[] brokerPath;
@@ -67,7 +67,7 @@
                        set { this.connectionId = value; }
                }
 
-               public ActiveMQDestination Destination
+               public IDestination Destination
                {
                        get { return destination; }
                        set { this.destination = value; }

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=724827&r1=724826&r2=724827&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 
Tue Dec  9 10:56:14 2008
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 using System;
 using System.Collections;
 using System.Threading;
 using Apache.NMS.ActiveMQ.Commands;
-using Apache.NMS;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.ActiveMQ
@@ -41,7 +41,7 @@
                private long producerCounter;
                internal bool startedAsyncDelivery = false;
                private bool disposed = false;
-        private bool closed = false;
+               private bool closed = false;
                private bool closing = false;
                private TimeSpan MAX_THREAD_WAIT = 
TimeSpan.FromMilliseconds(30000);
 
@@ -326,6 +326,18 @@
                        return answer;
                }
 
+               /// <summary>
+               /// Delete a destination (Queue, Topic, Temp Queue, Temp Topic).
+               /// </summary>
+               public void DeleteDestination(IDestination destination)
+               {
+                       DestinationInfo command = new DestinationInfo();
+                       command.ConnectionId = Connection.ConnectionId;
+                       command.OperationType = 
DestinationInfo.REMOVE_OPERATION_TYPE; // 1 is remove
+                       command.Destination = destination;
+
+                       this.DoSend(command);
+               }
 
                public IMessage CreateMessage()
                {
@@ -334,7 +346,6 @@
                        return answer;
                }
 
-
                public ITextMessage CreateTextMessage()
                {
                        ActiveMQTextMessage answer = new ActiveMQTextMessage();
@@ -445,17 +456,7 @@
                {
                        DestinationInfo command = new DestinationInfo();
                        command.ConnectionId = Connection.ConnectionId;
-                       command.OperationType = 
DestinationInfo.ADD_OPERATION_TYPE ; // 0 is add
-                       command.Destination = tempDestination;
-
-                       this.DoSend(command);
-               }
-
-               protected void DestroyTemporaryDestination(ActiveMQDestination 
tempDestination)
-               {
-                       DestinationInfo command = new DestinationInfo();
-                       command.ConnectionId = Connection.ConnectionId;
-                       command.OperationType = 
DestinationInfo.REMOVE_OPERATION_TYPE ; // 1 is remove
+                       command.OperationType = 
DestinationInfo.ADD_OPERATION_TYPE; // 0 is add
                        command.Destination = tempDestination;
 
                        this.DoSend(command);

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs?rev=724827&r1=724826&r2=724827&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
 Tue Dec  9 10:56:14 2008
@@ -57,7 +57,7 @@
                        tempDestinations.Add(info);
                }
 
-               public void removeTempDestination(ActiveMQDestination 
destination)
+               public void removeTempDestination(IDestination destination)
                {
                        for(int i = tempDestinations.Count - 1; i >= 0; i--)
                        {


Reply via email to