-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffering messages locally if broker is unavailable? #236
Comments
In general, I suggest the caller of emqtt buffer the messages to simplify the error handlings in emqtt. with if you do sync publish QoS 1 message, the caller get blocked if peer node is down. For references you could check the mqtt bridge impl. in EMQX. |
I assume --reconnect refers to the CLI tool? I'm using emqtt as a library. Does it work the same when using the reconnect option? If I understand you correctly, emqtt will buffere messages in RAM if you do an async publish while it's trying to reconnect? Can you say more about why you recommend buffering messages outside emqtt? |
yes. reconnect option should work when you use mqtt as lib.
yes. all publishs are postponed until connected so they are kind buffered in emqtt process
There are different preferences what to do when transport is in trouble or broker is unreachable. a. How many messages should be buffered? what is the limit? handle above features are out of scope of a mqtt protocol client and emqtt runs isolated in a process, it provides callbacks when messages are delivered/acked by peer and the caller is free to implement the feature above. |
Thank you for the reply, very helpful. |
take a look here: Line 527 in c815a18
|
Thank you for the link. I'm using emqtt from an Elixir app, so reading Erlang is bit challenging for me. |
Does it store only the last message send to each topic? |
emqtt/src/emqtt.erl that is you called the the 2nd element is a list of args that will be used to call the callback function, the emqtt will append the 3rd args with Result is a map with following keys:
|
depends on the connection states and QoS, message maybe dropped due to expired if msg expired is set. |
Thank you for the explanation.
Ok, but otherwise multiple outgoing messages are stored for ewach topic, not just the last? |
Are outgoing messages buffered locally if the broker is unaviable?
If yes, how many messages can be stored, and are they stored only in RAM, or is there a way to persist them on disk?
The text was updated successfully, but these errors were encountered: