Message Producer produces to default Destionation if set during creation
------------------------------------------------------------------------

                 Key: AMQNET-223
                 URL: https://issues.apache.org/activemq/browse/AMQNET-223
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ
    Affects Versions: 1.2.0
         Environment: Windows XP SP3, Windows 2003 Server, Windows 2008 Server, 
Active MQ 5.3
            Reporter: Michel Van Hoof
            Assignee: Jim Gomes
            Priority: Critical


During a test for another issue, i think i have found some rather strange but 
yet important behaviour.

When setting a default destination at creation of a MessageProducer, this 
producer can ONLY send to this default location. Message location.

For example, you create a producer to produce on queue.test, when you later on 
in your code, try to use the same producer to publsih to queue.test.DLQ, it 
DOES set the NMSDestination correctly, but it produces to queue.test..

Some example code:

{code:title=test.exe|borderStyle=solid}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Apache.NMS;
using Apache.NMS.ActiveMQ;

namespace TransactionTest
{
    class Program
    {
        static void Main(string[] args)
        {
            IConnectionFactory oFactory = new 
ConnectionFactory("failover:(tcp://10.32.1.24:1414)");
            IDestination oDestionation = new 
Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("producer.test");
            IDestination oDLQ = new 
Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("producer.test.DLQ");
           
            
            
            IConnection oConnection = oFactory.CreateConnection();
            oConnection.Start();



            ISession oProducerSession = oConnection.CreateSession();
            ISession oSession = oConnection.CreateSession();
            IMessageProducer oProducer = 
oProducerSession.CreateProducer(oDestionation);
            //Should arrive in "producer.test" since no idestination has been 
given
            oProducer.Send(oProducer.CreateTextMessage("TEST MESSAGGE"));

            //should arrive in producer.test.dlq since alternate destination 
was given to producer
            ITextMessage oMessge = new 
Apache.NMS.ActiveMQ.Commands.ActiveMQTextMessage("TEST MESSAGE DLQ");
            oProducer.Send(oDLQ, oMessge);


            Console.WriteLine("Sending testmessages DONE");
            //now.. for the consuming Part...


            IMessageConsumer oConsumer = oSession.CreateConsumer(oDestionation);
            oConsumer.Listener += OnMessage;
           
            Console.ReadKey();
           



        }


        private static void OnMessage(IMessage message)
        {

            //HERE you will see that both messages, although the NMSDestination 
on the message is set correctly, arrive at the queue: producer.test sicne this 
is the only one our consumer is listening too, even though they have been 
published to two seperate destinations.
            Console.WriteLine("Message Received on queue: " + 
message.NMSDestination.ToString());
            
        }
    }
}

{code} 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to