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

Hi There ,

Please find the response inline below

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.   

> So I wanted to understand, How long that message will be buffered on
> client, or when it will be dropped by mqtt client?

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
  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
    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. 

Not having a clue, I would expect that when the process exits, the
pending messages are lost.  I would also perhaps expect some largish
limit on buffered messages, which when exceeed perhaps results in
dropping old ones, and perhaps results in an error.

> I wanted to log such messages which are not published and drop at client
> itself?

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

Back to the top