How to enable MQTT Retained Events?

Hello, I receive data very slowly from end devices, so when my app connects to the MQTT server that Chirpstack updates, I want it to receive the last updated value. My codec already attaches a timestamp each time the data comes in from remote devices, so I can tell when the data was received.

I found this unrelated page that shows a setting in ./etc/chirpstack-application-server/chirpstack-application-server.toml called retain_events. I tried to set this value to true and restart everything, but it never retains the incoming data.
Also, as seen in the code here, the retain_events setting does seem to be supported.

What am I doing wrong?

Chirpstack application server version 3.17.2 on Raspberry Pi Debian 10

Thank you.

1 Like

I have the same issue. Found any solution?

I believe this is not supported in V4. In order to set messages to retained, it must be done from the publisher and I see no conf for this in the gateway bridge (except for state messages). However, there are definitely work arounds.

The first option that comes to mind is to set up an MQTT bridge that reposts the events to a different topic with the retain flag set. Just make sure to enable persistence in your mosquitto.conf.

Then your application subscribes to these other topics rather than the traditional application/.