0

I want to simulate guaranteed delivery scenario where connection is unreliable (using mosquitto_pub and mosquitto_sub utilities). Connection can be unreliable on both producer as well as subscriber side.

Assume:

[Producer] --(1)--> [Broker] --(2)--> [Subscriber]

On subscriber side (segment #2 above), I am able to get reliable delivery using QoS > 0 and disabling clean session. Broker holds all messages if the subscriber disconnects and delivers them on next reconnect.

mosquitto_sub -h <brokerIP> -t testtopic -i testsubid -c -q 1

Question: How can I achieve the same on segment #1 (producer to broker)?

I want producer to keep "publishing" messages while network is unavailable, and want them delivered to broker once network is restored. Any way to do it out-of-the-box with mqtt library (storing messages on producer side)? In case if it helps, my final implementation will be in paho/python.

Thanks in advance.

S2L
  • 1,746
  • 1
  • 16
  • 20
  • What have you tried with the Python Paho library? The client should queue messages when the broker is offline (see [docs](https://www.eclipse.org/paho/index.php?page=clients/python/docs/index.php#max-queued-messages-set) – hardillb Oct 15 '20 at 18:38
  • Thanks. I will give it a try soon. Meanwhile, is there a way to do it with command line utilities (mosquitto_pub/sub)? – S2L Oct 17 '20 at 15:26

0 Answers0