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

NMS library with activemq is missing OriginalDestination when message retrieved from DLQ

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Versions used:

      Artemis : apache-artemis-2.22.0

      Apache.NMS : 1.8.0

      Apache.NMS.Activemq : 1.8.0

      Following is the code,

       

      using Apache.NMS;
      using Apache.NMS.Util;
      using NUnit.Framework;
      using System.Collections;
      [Test]
      public void DataMatchActiveMQTest()
      {
         using (IConnection connection = GetConnection("activemq:tcp://localhost:61616"))
         using (session = connection.CreateSession(AcknowledgementMode.IndividualAcknowledge))
         {           
            IDestination destinationDlq = SessionUtil.GetDestination(session, "queue://DLQ");
            IDestination destination = SessionUtil.GetDestination(session, "queue://ArtimesTest");
            // Create a consumer and producer
            using (IMessageConsumer consumerDlq = session.CreateConsumer(destinationDlq))
            using (IMessageConsumer consumer = session.CreateConsumer(destination))
            using (IMessageProducer producer = session.CreateProducer(destination))          
            {
               // Start the connection so that messages will be processed.                     
               connection.Start();
               producer.DeliveryMode = MsgDeliveryMode.Persistent;
               producer.RequestTimeout = receiveTimeout;
               consumer.Listener += new MessageListener(OnMessage);
               consumerDlq.Listener += new MessageListener(ConsumerDlq_Listener);
               //consumerDlq.Receive();                     
               // Send a message                     
               IObjectMessage request = session.CreateObjectMessage(GetData());
               //session.CreateTextMessage("TextMessage");                     
               session.CreateObjectMessage(GetData());                          
               producer.Send(request);
            }
       
      private void ConsumerDlq_Listener(IMessage message)      
      { 
         // message.OriginalDestination is null here. 
         // neither we are able to get it through any other properties            }
      private static IConnection GetConnection(string uri)
             
      {             
      Uri connecturi = new Uri(uri);             
      Console.WriteLine("About to connect to " + connecturi);             
      // NOTE: ensure the nmsprovider-activemq.config file exists in the executable folder.             IConnectionFactory factory = new NMSConnectionFactory (connecturi);             IConnection connection = factory.CreateConnection();             return connection;         }
       protected static void OnMessage(IMessage receivedMsg)
             
      {            
      throw new Exception("DLQ exception");
      }
      

      This was working in the earlier versions of ActiveMq. We are not able to replay messages using code at a later stage as we are not getting the Original Queue and address

      Attachments

        Activity

          People

            Unassigned Unassigned
            Vidds Vidyadhar Parulekar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: