Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Java MqttAsyncClient Flow Control / Offline Buffering

Alex,

thanks for the comments.    I'd planned "Simple Offline Buffering" for a 1.2 release of Paho:

https://projects.eclipse.org/projects/technology.paho/releases/1.2.0

although the dates on that will change, not least because I'm on vacation for a month from the middle of November.

The way I'd envisaged it working (in the C and _javascript_ clients too), is that you would be able to call publish() regardless of whether the clients were connected, so the changes to the API would be minimal.  This would be outbound buffering only - the broker you connect to already buffers messages outbound to the client (assuming cleansession is False).

Ian

On 10/03/2014 09:49 AM, Alex Helder wrote:
I often find myself in one of the following scenarios with the Paho Java client, with no elegant solution:

1) A Producer creates messages to publish regardless of whether the Paho client is connected to a broker or not. I must queue these messages myself when not connected to a broker.

2) When connected to a broker, flow control using the MqttAsyncClient's publish() method is awkward.  This method can throw an exception for QoS1/QoS2 messages if the maximum number of 'inflight' messages is reached - but this limit is not knowable, and there is no flow control or back-pressure to prevent inadvertently tripping over it. The only way to establish flow control is to immediately block after publish() using IMqttToken.waitForCompletion() - effectively turning this into the blocking client.

I think the solution to this is that the Paho client API should /appear/ as a queue to the user. If the client is offline, QoS 0,1,2 messages can be added to the queue. When the client connects to the broker, it can consume the persisted queue.

Additionally:

* Internally, the queue and MqttClientPersistence should be the same store.

* The user should be able to provide an implementation of a queue which can be configured in several ways: (1) in memory or persisted (this is possible now), (2) bounded or unbounded



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top