Aurantium's goal is to be an MQTT publisher. The steps to publish data are as follows:
- On startup, connect to the MQTT broker.
- Read files one by one from a given folder path.
- In each contained file, read the data line by line skipping the first line (contains column names).
- For each line read, create a Machine object and schedule a Publish message to the MQTT broker.
Run from the root directory of the project to build the .jar file.
mvn clean install -DskipTests -f aurantium/pom.xml
Note: Depends on Protobuf module. Consider building it first.
To run locally, you need to have a Mosquitto broker up and running and then run Aurantium.
- Create a .conf file with some simple configuration:
echo -e 'listener 1883 \nallow_anonymous true' >> mosquitto.conf
. - Install and run the broker:
- Install it locally with
apt install mosquitto
. Run it withmosquitto -c {FULL_PATH_OF_CONF_FILE}
. Or, - Use a Docker image. Pull it with
docker pull eclipse-mosquitto:2.0.11
. Run it withdocker run -it -p 1883:1883 -v {FULL_PATH_OF_CONF_FILE}:/mosquitto/config/mosquitto.conf eclipse-mosquitto:2.0.11
.
- Install it locally with
Run AurantiumApplication.java with the following env variables:
- filePath={FULL_PARENT_PATH}/citrus/aurantium/src/main/resources/iot-data/machine
- machine.id=0
- mqtt.host=127.0.0.1
- mqtt.port=1883
- publish.delay=1
Run from the root directory of the project to build the Docker image. Consider having a Mosquitto broker already up and running.
docker compose build aurantium
Run from the root directory of the project to run the Docker image(s).
bash aurantium/scripts/start-aurantium.sh {NUMBER_OF_INSTANCES}