We need Chirpstack application server to publish device events to a RabbitMQ exchange, which is possible from version 3.7, according to the documentation, but when configuring the application, the Rabbit MQ integration is simply not available.
The only available integrations are the following ones:
As an application integration, forwarding all the device events from a specific application to a specific external queue ([chirpstack site]/chirpstack.io/application-server/integrations/amqp/)
We need the second one. It is true though, that the documentation has a placeholder for configuring this, that seems to be a general configuration, and not application specific ([chirpstack site]/application-server/install/config/)
# AMQP / RabbitMQ.
[application_server.integration.amqp]
# Server URL.
#
# See for a specification of all the possible options:
url="amqp://guest:guest@localhost:5672"
# Event routing key template.
#
# This is the event routing-key template used when publishing device
# events.
event_routing_key_template="application.{{ .ApplicationID }}.device.{{ .DevEUI }}.event.{{ .EventType }}"
This configuration shall enable specifying a rabbit exchange, but it seems this is not possible and it will always use the “AMQP Default” RabbitMQ exchange. Please, feel free to correct me if I’m mistaken.
The routing key might specify the name of the queue, but it will only be possible to forward all the events to that single queue, not being able to make bindings to different queues through a routing key template.
There are also configurations for the rest of application integrations at general level, that are also available per-application in the Web User Interface, so I’m a little bit confused.
I also tried to configure these parameters in the AS config file, and I was unable to forward device events to Rabbit.
This topic does not talk about this, but I think it is important to add some context about what RabbitMQ is.
RabbitMQ was always an AMQP broker at its heart. Prior to 3.12.0, MQTT was supported as a plugin, which adapted MQTT traffic through its AMQP internals. From 3.12.0, MQTT became natively supported.
In the default Docker examples for Chirpstack, the Mosquito MQTT broker is used for bridging the Chirpstack gateway bridge with the Network Server (now the main app of Chirpstack itself), as well as between the Chirpstack Application Server (now also the main app of Chirpstack itself) with any 3rd party apps (the MQTT integration, which is implicitly enabled).
So, RabbitMQ can be a drop-in replacement for the default Mosquitto MQTT broker, without bothering with AMQP. Or, perhaps AMQP could be used for the integration between the AS and 3rd party app (as described in an earlier post).
Just to make sure I understand this correctly (and since chirpstack changed a lot since this post was created):
The [integration.amqp] in the config file is for the backend configuration, not the application integration?
If I want to use RabbitMQ I should thus just use the MQTT application integration and direct that to my RabbitMQ server and there is no AMQP application integration?
Hi. Chirpstack doesn’t use AMQP for its backend data flows. Only MQTT is used for its data flows.
Sections of the configuration file like this one you refer to, are for integrations with 3rd party applications.
RabbitMQ has always been an AMQP broker at heart. It does support MQTT, but there is some translation of MQTT behaviours to its AMQP inner workings. It got much more efficient from 3.12.0, but surely it is still an AMQP broker.
So unless you are using RabbitMQ as a MQTT broker, I suppose the AMQP integration would result in a straightforward routing of data to RabbitMQ?
A bit of background info: I have a RabbitMQ server that currently serves as my MQTT broker from my gateways to chirpstack. I now want to add an application so devices can send data to my RabbitMQ so I can distribute it further from there. I’d wanted to do this using AMQP instead of MQTT.
So when you say 3rd party application, do you mean the applications that devices can be assigned to?
If not, then I’m having trouble activating the MQTT integration as it directs me to generate a client certificate, but that isn’t required by my network/RabbitMQ.
Yes, but I am not sure if we have the same idea. I meant software applications that could work with Chirpstack, which has some relationship with the concept of applications in Chirpstack. To receive data from its devices and/or to issue downlinks.
MQTT integration is enabled via the configuration file, not the UI. You need to enable the integration by adding “mqtt” to the “enabled” array in “integration”.
If you actually wanted to use AMQP, I don’t suppose the MQTT integration feature would be better than the native AMQP integration feature.
Ah, I noticed that there’s now an open channel on my RabbitMQ server. I suppose that is the one that would be used by the 3rd party application to access the Chirpstack then?
I have yet to write the software but got confused about how to integrate it with Chirpstack. I thought I could go into the Chirpstack application to activate the AMQP integration there, but instead I configure the AMQP integration from the config file and then use the resulting channel in my external application?
If I don’t have to use MQTT then I’d rather use AMQP, yes.
Hi, just to get back to this quickly. I’m still a bit confused.
I have a setup with Chirpstack and RabbitMQ. RabbitMQ currently serves as the broker between Chirpstack and the gateways. I now want to write a (3rd-party) application/integration that takes data that arrives in Chirpstack and send that to an AMQP exchange/queue on my RabbitMQ.
Is this possible with the AMQP integration configured in the config file of Chirpstack?
Do I just code the 3rd-party application to use the channel that opens between RabbitMQ and chirpstack?
Are there examples for such 3rd-party applications somewhere?