activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r896202 - /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs
Date Tue, 05 Jan 2010 20:26:20 GMT
Author: tabish
Date: Tue Jan  5 20:26:19 2010
New Revision: 896202

URL: http://svn.apache.org/viewvc?rev=896202&view=rev
Log:
Ensure producers throw correct exceptions on send to non-default destinations

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs?rev=896202&r1=896201&r2=896202&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/MessageProducer.cs Tue
Jan  5 20:26:19 2010
@@ -155,10 +155,25 @@
                 throw new Apache.NMS.InvalidDestinationException();
             }
 
+            Destination dest = null;
+
+            if(destination == this.info.Destination)
+            {
+                dest = destination as Destination;
+            }
+            else if(info.Destination == null)
+            {
+                dest = Destination.Transform(destination);
+            }
+            else
+            {
+                throw new NotSupportedException("This producer can only send messages to:
" + this.info.Destination.PhysicalName);
+            }
+
             Message stompMessage = (Message) message;
 
             stompMessage.ProducerId = info.ProducerId;
-            stompMessage.FromDestination = destination;
+            stompMessage.FromDestination = dest;
             stompMessage.NMSDeliveryMode = deliveryMode;
             stompMessage.NMSPriority = priority;
 



Mime
View raw message