1.15 AMQP/RabbitMQ integration

If you have an external system that needs to know about updates inside of DHIS2 (update data element, create org unit, etc.) you can set up a rabbitmq message broker, and have it receive messages from DHIS2, then other clients can listen to this broker and be notified when events happen. Configuration of this is performed in “dhis.conf” where the following keys are available (defaults values are shown):

rabbitmq.host =
rabbitmq.port = 5672
rabbitmq.addresses =
rabbitmq.virtual-host = /
rabbitmq.exchange = dhis2
rabbitmq.username = guest
rabbitmq.password = guest
rabbitmq.connection-timeout = 60000

The only required key to enable rabbitmq is “host”, if the rest of the values are applicable for your instance you can just use the defaults provided.

Inside DHIS2 it communicates with AMQP using a topic exchange called “dhis2” (unless you have configured it to be called something else), and the following keys are sent out:

metadata.<type>.<action>.<id>

Where type can be any type inside of DHIS2 (data element, indicator, org unit, etc.), action is CREATE, UPDATE, DELETE and id is the id of the type being handled. The event also contains a payload, for CREATE and DELETE this is the full serialized version of the object, for UPDATE its a patch containing the updates that are happening on that object.