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.




--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Apache-Artemis-1-5-2-MQTT-how-to-create-a-durable-subscriber-My-messages-are-lost-tp4723455.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to