You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Vidyadhar Parulekar (Jira)" <ji...@apache.org> on 2022/06/14 10:51:00 UTC

[jira] [Updated] (AMQNET-775) NMS library with activemq is missing OriginalDestination when message retrieved from DLQ

     [ https://issues.apache.org/jira/browse/AMQNET-775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vidyadhar Parulekar updated AMQNET-775:
---------------------------------------
    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);

                    //Wait for the message

                   semaphore.WaitOne((int)receiveTimeout.TotalMilliseconds, true);
                }

 

 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;
        }

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

> NMS library with activemq is missing OriginalDestination when message retrieved from DLQ
> ----------------------------------------------------------------------------------------
>
>                 Key: AMQNET-775
>                 URL: https://issues.apache.org/jira/browse/AMQNET-775
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>            Reporter: Vidyadhar Parulekar
>            Priority: Major
>
> 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);
>                     //Wait for the message
>                    semaphore.WaitOne((int)receiveTimeout.TotalMilliseconds, true);
>                 }
>  
>  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;
>         }
> This was working in the earlier versions of ActiveMq. We are not able to replay messages using code at a later stageas we are not getting the Original Queue and address



--
This message was sent by Atlassian Jira
(v8.20.7#820007)