Quantcast

[Apache Artemis 1.5.2][MQTT] how to create a durable subscriber - My messages are lost

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Apache Artemis 1.5.2][MQTT] how to create a durable subscriber - My messages are lost

Deomisr
Hi,

How can I create a durable subscriber.

Indeed when my consumer is disconnected, I lose my messages.

I create a durable queue but nothing change.
Broker.xml :
....
<queues>
   <queue name="digital.test.data">
      <durable>true</durable>
    </queue>
</queues>
......

If I disconnect my consumer, when I reconnect it, I don't receive any messages.

Exemple of subscriber :
BlockingConnection connection =  null;
try{
        connection = mqtt.blockingConnection();
  connection.connect();      

  Topic[] topics = {new Topic("digital/test/data", QoS.EXACTLY_ONCE)};
  connection.subscribe(topics);
     
  System.out.println("Subscribed to topics.");

  while( continue)
        {
              Message message = connection.receive(5, TimeUnit.SECONDS);
              if(message != null)
              {
             System.out.println("Received messages.");
             System.out.println(new String(message.getPayload()));
             message.ack();
              }
             
         }
}
catch(Exception e)
    {
    e.printStackTrace();
    }
    finally{    
     if(connection!=null)  connection.disconnect();
    }

What i need to do in the broker.xml file.

Best regards.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Apache Artemis 1.5.2][MQTT] how to create a durable subscriber - My messages are lost

Deomisr
I solved my issue.
My issue came from the  <expiry-delay>. his value was 300 i put 60000 and all works fine.
Loading...