Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] About paho mqtt client buffers/holds message

Shivam Seth <shivam.jma@xxxxxxxxx> writes:

> On Thu, Apr 2, 2020 at 8:38 PM Greg Troxel <gdt@xxxxxxxxxx> wrote:
>> Shivam Seth <shivam.jma@xxxxxxxxx> writes:
>> > If this is not right place to ask questions, Please guide me to correct
>> > path.
>> It seems right.
>> > I am using *python** based paho mqtt client*.
>> > When MQTT broker get disconnected, the messages at mqtt client will be
>> > buffered, which are there to be publish to broker.
>> paho python is a library.  Did you write code to use the library?
> *SHIVAM : *Yes, I have written some code and used paho library to create
> client, connect to broker and publish message to mosquitto broker.

If you publish a link to your code, that might get some comments (but
might not).
>> Can you point to where in the docs this should be explained and what you
>> found there?
> *SHIVAM :* I didn't found any information documented. I have done one
>> practical

I meant "read the entire documentation and tell the list where what you
want to know should be explained and isn't", thinking that might cause
someone who knows to add it.

>    1.      Start mosquitto broker on command prompt.
>    2.      Start python script to connect("", port=1883,
>    keep_alive=60) to mosquitto broker. (start publishing message's in
>    background, using start_loop() function )
>    3.      Kill terminal on which mosquitto was running
>    4.
>       1. Python client will try to re-connect to server internally. (This
>       functionality is in start_loop()  )
>       2. After sometime Start mosquitto broker again on command prompt
>    5. Paho client code will internally re-connect and publish the message.
> After facing such situation, I got doubt that it is buffering such
> messages, (On debugging paho client library code , I found there is a
> variable called _out_messages which is python ordered dictionary and
> holding messages.

Sounds like you are well on your way to figuring this out.

>> I would suggest reading the source code.
> *SHIVAM :* I am doing that, I wanted to understand, Is there any standard
> specification about such messages.

You could read the MQTT specs.  I would expect that endpoint behavior
like this is not specified, but I don't know.

One could also implement something that stores messages to be sent in
stable storage (disk), in files or a database, so that messages would be
buffered across invocations of the client.  I have been thinking of this
for xmpp, sort of making it like a mail program that stores drafts.

Back to the top