You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Deomisr <pa...@edf.fr> on 2017/03/09 14:48:35 UTC

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

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.

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

Posted by Deomisr <pa...@edf.fr>.
I solved my issue.
My issue came from the  <expiry-delay>. his value was 300 i put 60000 and
all works fine.



--
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-tp4723455p4723535.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.