Hi everyone,
I am using ChirpStack to manage LoRaWAN devices, and I need to route messages from different applications to separate MQTT brokers. Specifically:
- Messages from
application 1
should go to MQTT Server 1 (Mosquitto 1).
- Messages from
application 2
should go to MQTT Server 2 (Mosquitto 2).
Here are my question:
- Is it possible to configure ChirpStack directly to send each application’s messages to a different broker? If yes, how?
Unfortunately there is no MQTT integration in the same way as the HTTP or SQL integrations where you can forward to separate servers dependant on application. In default Chirpstack you either forward all MQTT traffic to a separate broker by configuring the [integration.mqtt] section in your Chirpstack.toml, or have your separate servers subscribe to your MQTT broker.
There are two options I can think of to achieve the functionality you want:
- In MQTT you can restrict access to topics however you like, so typically you’d just want to restrict access so clients connecting to Chirpstacks broker can only access their application.
- Create a middle man that will subscribe to Chirpstacks broker and publish the appropriate topics to the appropriate brokers.
Hi, welcome to the forum!
Rather than imply ChirpStack in the process or imply a “repeater” middle man, know that this can be achieved directly in mosquitto by configuring bridges inbetween one or more brokers. See mosqutto.conf man page in Configuring Bridges section.
So ultimately, ChirpStack continues to publish on a single broker, but you configure the broker to bridge the topic(s) you want to different brokers as per your needs, using prefixes/wildcards.
Hope this helps,
Nicolas
1 Like