Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] MqttAsyncClient - inflight message limit

Hi Davy,

1) You can set a callback on the publish method, which will be called when each publish has completed.  This way you can count how many messages are in flight and delay the call to publish.

2) We also have an enhancement currently under review which allows the application to set the maximum number of inflight messages allowed.  I hadn't got to reviewing it yet -- I hope to do so this week or next.

Ian


On 01/26/2015 11:07 AM, Davy De Waele wrote:
Hi,

I started implementing a solution based on the java MqttAsyncClient since I needed to obtain the IMqttToken for message bookkeeping due to some limitiations with the syncClient.

However I noticed the following :

When sending a substantial number of msgs in a short timestamp, the risk of running into the max inflight messages is very high (writing a loop that sends 20 msgs to a topic results in "Too many publishes in progress (32202)" about half of the time. 

This is not the case with the syncClient because you allow for some time for the message to get sent before moving on to the next one.

How should we handle this ? Our broker is perfectly capable of handling this type of load, but here it seems that the client is the bottleneck.

Should the asyncClient always be used by specifying a waitForCompletion on the mqttDeliveryToken to avoid having too much inflight messages in the client ?

mqttDeliveryToken.waitForCompletion(200);

Regards,
Davy



_______________________________________________
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