Skip to content

Latest commit

 

History

History
37 lines (20 loc) · 1.6 KB

File metadata and controls

37 lines (20 loc) · 1.6 KB

MQTT EDA integration

This use case shows how Event Driven Automation can be integrated with MQTT messaging brokers, to interact with messages received from other platforms.

This integration uses a containerized Mosquitto instance, present as a container in the utils folder to handle the events.

Running Mosquitto container

This integration uses a Mosquitto instance, present as a compose in the utils folder to handle the messages, that instantiates a container for Mosquitto, available on port 1883 of the host.

No additional configuration is needed.

A podman-compose file is available here, and automatically exposes port 1883 on all interfaces.

To run it:

cd utils/
podman-compose -f mosquitto-compose.yml up

MQTT integration

In this use case, you can simulate a message, using the following script specifying the hostname/IP of the Mosquitto instance (defaults to localhost) and the port (defaults to 1883).

It generates a simple message, that will trigger a Job Template on AAP2, showing the event information.

Configuration

In order to run these use cases, setup scripts are available here:

ansible-playbook configure-use-case.yml -e @use-cases/use-case-mqtt-setup.yml

Testing the MQTT integration

A script in the utils directory allows to connect to a --host (defaults to localhost) on --port (defaults to 1883) and send a test message to trigger automation:

cd utils/
python3 mqtt-sender.py