Justin, thx a lot. that did it!
________________________________
From: Justin Bertram <jbert...@apache.org>
Sent: Wednesday, September 13, 2023 18:02
To: users@activemq.apache.org <users@activemq.apache.org>
Subject: Re: messages not moved to DLQ

[You don't often get email from jbert...@apache.org. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

In order to register the delivery attempt you need to acknowledge the
message, e.g.:

  while(true)
  {
      System.out.println("waiting for message");
      ClientMessage rec = consumer.receive(5000);
      if(rec == null) break;
      rec.acknowledge();
      System.out.println(rec.getStringProperty("text"));
      session.rollback();
  }


Justin

On Wed, Sep 13, 2023 at 4:01 AM Andreas Lanzl <andreas.la...@klipp.at>
wrote:

> Hi all.
>
> I'm trying to test the DLQ function in artemis V 2.30.0 but i can't get it
> working. My setup is like so:
> running artemis inside docker container with default configuration.
> According to the docs the
> max-delivery-attempts is by default 10. below is a little test programm
> written in java using the core client to connect to artemis. this test
> program creates a queue and sends one message and then consumes this
> message and rollback every consume. the issue is now that the message is
> received over and over again and not moved to the DLQ after 10 transmits.
> I also tried to set the max-delivery-attempts setting in broker.xml but
> this does not work either. (i have to mention that core client version is
> 2.19.1 due i use java 8)
>
> pls someone can point me in the right direction.. thx.  -andreas
>
>
>
> ServerLocator locator =
> ActiveMQClient.createServerLocator("tcp://localhost:61616");
> ClientSessionFactory factory = locator.createSessionFactory();
> ClientSession session =
> factory.createSession("artemis","artemis1234",false,false,false,false,1);
>
> session.createAddress(new SimpleString("test"), RoutingType.MULTICAST,
> false);
>
> QueueConfiguration configuration = new QueueConfiguration("queue");
> configuration.setAddress("test");
>
> session.createQueue(configuration);
>
> ClientProducer producer = session.createProducer("test");
> ClientMessage message = session.createMessage(true);
> message.putStringProperty("text","test");
> producer.send(message);
> session.commit();
>
> session.start();
> ClientConsumer consumer = session.createConsumer("queue");
>
> while(true)
> {
>     System.out.println("waiting for message");
>     ClientMessage rec = consumer.receive(5000);
>     if(rec == null) break;
>     System.out.println(rec.getStringProperty("text"));
>     session.rollback();
> }
>
> session.close();
>
>

Reply via email to