Hi Owen,
as Manuel says, in the development branch there is a method to allow
you to configure the maximum number messages inflight.
This might seem strange, but this wasn't designed to allow
applications to publish messages when not connected to a broker
(you can't, at the moment). It was only intended to store the state
of inflight QoS 1 and 2 messages so that the MQTT protocol exchanges
could be completed when the application reconnects.
Some reasons why publishing while not connected was thought a bad
idea at the time:
- a lot of messages could be stored in the queue, when this is
not the best place to store them (it's not a database)
- we'd have to add methods to administer the queued messages
(query, delete, etc)
- if the application never successfully connected, queued
messages would never be sent
However, many people have come to expect the function, regardless of
the drawbacks, so it is now high on our to-do list, in the C clients
as well as Java. I have opened a bug
440736: Allow applications to call publish when not connected
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440736
but this is for all clients. I should open one for each so it's
more obvious.
Ian
On 09/23/2015 09:09 AM, Manuel
Domínguez Dorado wrote:
Owen,
you can change this value by calling getMaxInflight() of
MqttConnectOptions. Also, you can control the number of messages
that are currently inflight vía a counter that is increased when
publish() is called and decreased when deliveryComplete()
callback is executed. Using this counter you can avoid the REASON_CODE_MAX_INFLIGHT exception.
Regards.
_______________________________________________
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
|