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/14 23:03:24 UTC

svn commit: r890496 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs

Author: tabish
Date: Mon Dec 14 22:03:23 2009
New Revision: 890496

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

Update MessageProducer to properly check the value of the default destination and not allow a client to perform a send to a destination that is not the default if one was set.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs?rev=890496&r1=890495&r2=890496&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.2.x/src/main/csharp/MessageProducer.cs Mon Dec 14 22:03:23 2009
@@ -171,10 +171,25 @@
                 throw new Apache.NMS.InvalidDestinationException();
             }
 
+            ActiveMQDestination dest = null;
+
+            if(destination == this.info.Destination)
+            {
+                dest = destination as ActiveMQDestination;
+            }
+            else if(info.Destination == null)
+            {
+                dest = ActiveMQDestination.Transform(destination);
+            }
+            else
+            {
+                throw new NotSupportedException("This producer can only send messages to: " + this.info.Destination.PhysicalName);
+            }
+
             ActiveMQMessage activeMessage = (ActiveMQMessage) message;
 
             activeMessage.ProducerId = info.ProducerId;
-            activeMessage.FromDestination = destination;
+            activeMessage.Destination = dest;
             activeMessage.NMSDeliveryMode = deliveryMode;
             activeMessage.NMSPriority = priority;