Uploaded image for project: 'ActiveMQ .Net'
  1. ActiveMQ .Net
  2. AMQNET-223

Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0
    • ActiveMQ
    • None
    • Windows XP SP3, Windows 2003 Server, Windows 2008 Server, Active MQ 5.3

    Description

      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:

      test.exe
      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());
                  
              }
          }
      }
      
      

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            mvhoof Michel Van Hoof
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: