Auto-reconnect, buffer data for sending if network disconnects

We are using .Net core 6, MQTTNet nuget.

When we use MQTT bridge how do we configure our local broker to auto-reconnect and buffer data till the connection comes back. Also how do we authenticate a MQTTClient with local or remote broker. Does EMQX has a mechanism to compress the data ?

I can only answer your first question. To get the data that was published while the network was disconnected, do the following:

  • Make sure your producer creates QoS 1 or 2 data
  • Make sure your consumer client subscribes with a persistent session
  • Set the expiry interval to something long (maximum network outage you expect)
  • When your consumer client reconnects and subscribes again, make sure to use the same client ID, so the server knows it should send the buffered data

More info here.