Settings for an infrequent bridge

I am looking for the proper mosquito.conf settings for an infrequent bridge connection. I have the bridge part down, but I’m wondering about timeouts, etc.

My situation is I have three brokers that talk to each other. They may do a few changes in an hour - and then none in a week or more. So having them ping each other every 60 seconds seems wrong.

I set the keepalive_interval to 3600, but then started getting problems. My guess is it is some sort of half open tcp connection? Or some other connection issue. When I restart the containers, all work again as planned.

Ideally, I’d like them to just close down the connection - either every time, or after say 5 minutes. The performance hit of reopening connections is unimportant to me.

Sorry if this is obvious but it’s hard to tell if my changes make sense.

Hi,

I would suggest using the lazy bridge start type. This only opens the bridge connection if there are messages ready to send to the remote side, then closes the bridge after a timeout.

connection lazybridge
address <host>:<port>
topic mytopic out
start_type lazy
threshold 1
idle_timeout 60

The caveat is that if you need to handle incoming messages then there is no easy way to deal with that.

Regards,

Roger

Full details on the options are in here: mosquitto.conf man page | Eclipse Mosquitto

That is exactly what I was hoping would exist! But your caveat is super helpfu. That would have bitten me for sure. I guess I need the constant pings to make sure the connection is bi-directional and the roundtrip is quick. Drat. Oh well - it’s only minimal bandwidth.

Thanks @roger.light

1 Like