Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] [Android Client] Offline messages going in random order

Hi James,
Thanks for the response. Our use case is a chat app like Whatsapp.
My broker (Mosca) doesn't seem to support maxInflightMessages well.

Since there is no guarantee of order delivery with default max inflight messages setting, it seems that I will have to order the chat messages on the receiver side based on the timestamp in the payload. Am I right?

Thanks,
Satyadeep

--------------------------------------------
Hi Satyadeep,
That's odd, the disconnected message buffer is a FIFO buffer, so there should be no change in the order in which messages are sent. Keep in mind that if you want to limit inflight messages to 1, you will also need to set this on the broker as well as the client.
If the max inflight messages value is the default though, there is no way to guarantee in order delivery with QoS 1. Are you able to replicate this behaviour?
Kind regards,
James Sutton
Software Engineer - IoT Foundation - MQTT Open Source Projects
Ops Team - Wimbledon Project

Phone: 01962 815438 | Extension: x372454
E-mail: james.sutton@xxxxxxxxxx
Personal Website: www.jsutton.co.uk
Find me on:      

On Tue, Nov 1, 2016 at 7:52 PM Satyadeep <satyadeep.1991@xxxxxxxxx> wrote:
Hello,
We are using the MqttAndroidClient in our Android app with offline buffer options as following. 
We noticed that the messages published (qos: 1) when the app is offline are sent in a random order when the app comes back online. So if A, B, C, D are published to paho, they might be sent in D, B, A, C

We tried with setMaxInflightOptions(1), but in that case the offline messages are never sent at all.  

Is there a way to make the offline messages go in order?

Paho android and java version:  1.1.1-SNAPSHOT

MqttConnectOptions connOptions = new MqttConnectOptions();
connOptions.setAutomaticReconnect(true);
connOptions.setCleanSession(false);
connOptions.setMaxInflight(200);

DisconnectedBufferOptions disconnectedBufferOptions = new DisconnectedBufferOptions();
disconnectedBufferOptions.setBufferEnabled(true);
disconnectedBufferOptions.setBufferSize(1000);
disconnectedBufferOptions.setPersistBuffer(true);
disconnectedBufferOptions.setDeleteOldestMessages(false);

Thanks,
Satyadeep
--
Regards,
Satyadeep
--
Regards,
Satyadeep

Back to the top