Sharing the ChirpStack MQTT Broker

The MQTT broker that we use for one of our ChirpStack (v4.11.1) instances has approximately a dozen gateways communicating it. While the number of devices is growing (100s but will move to 1,000s) the MQTT broker (a high availability cluster from a SaaS provider) is still really underutilised.

One of the other software components that we have in our platform also requires a MQTT Broker to publish data to a 3rd party system, and from a cost perspective it would make sense for it to use the same MQTT broker as used for ChirpStack, as we would still have more than enough spare capacity.

We share our Valkey (Redis) cluster between ChirpStack and our platform by using the “key_prefix” setting in the [redis] ChirpStack configuration section and having a similar configuration option in our own platform; we would now ideally also like to do this or similar with the MQTT broker that we use.

There doesn’t seem to be a similar configuration setting as above for the MQTT integration (although please do correct me if I’m wrong), so I was wondering if we used a special prefix for the MQTT topics used in our own platform (say having them all start with “ourplatform/”) would this cause any issues with ChirpStack or would it simply ignore them (the MQTT broker login that we use for ChirpStack currently subscribes to all topics, so I was concerned that at the very least it may get irrelevant messages to ignore)?

If anybody knows of another approach to effectively share our MQTT broker between ChirpStack and our platform (e.g. altering the topic subscriptions that we use for our ChirpStack instance to be more specific) then please do let me know, as it would be very much appreciated.

Many thanks,

Mathew

No worries with doing this. Chirpstack only subscribes to the topics starting with <region-prefix>/gateway/..., and application/... if using the MQTT integration. so as long as you don’t interfere with those topics there will be no issues. It won’t even have to “ignore” your other messages as it won’t even see them unless posted to those topics.

That’s great!

Thank for the proving the information so swiftly; much appreciated.

Additionally, the prefixes are all configurable in the various TOML files for gateways, network server, and integration. I have frequently had clients configured with something like a lora/ prefix, and the same MQTT broker receives a bunch of other uses.

1 Like

Hi Brian,

Thank you for providing the further information; much appreciated.

I can see that there is a “topic_prefix” setting in the chirpstack-mqtt-forwarder.toml file (currently set to the associated region e.g. “eu868”) that could be used, and that there is an equivalent setting in the associated region file (e.g. region_eu868.toml) for the network server that in tandem look like they would take care of this for the gateways.

Having looked at the online documentation for the network server, and started it using the “–config . configfile” option, I can see that while there is no “topic_prefix” setting for MQTT there are “event_topic” and “command_topic” settings for the MQTT configuration that look like they are related to this.

However, I’m not sure if it is just a case of putting “lora/” at the start of the values given for the above settings or if there are additional steps (?). Would you mind please sharing the config options that would be required in the ChirpStack network server?

Many thanks,

Mat