Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Implementing health check for containerized MQTT server application?



On Sat, Jul 23, 2022 at 6:59 PM Steve Prior <sprior@xxxxxxxxxxxx> wrote:
Thinking about it a little more it gets a little more complicated, if I send the
ping message via MQTT topic then I'm actually testing not only what's in my
container but also the mosquito message broker and that's maybe not the right
thing to do for a container health checker.  I'd also have to come up with a
unique topic for each instance of my message responder and coordinate them
between the responder and the health checker.

It might be worth setting up a listener on a socket so the checker and responder
can just be on localhost within the container - setting up a REST API just for
this sounds a bit heavy.

I guess all this is why I was asking what people's favorite pattern is for this.

The device can self-report which also helps discovery.  Generate a unique topic and just publish to it regularly.  If you stop seeing updates, something might be wrong.  You can also use an LWT for reporting connection state.

It's possible to do RPC-via-MQTT as well (I use this to rendezvous with an application I can't connect directly to.  In my case, the client generates a temporary topic and sends it as a response topic along with a correlation ID.  This is a heavier use case, though (I use it to synchronize a database).

Back to the top