Contents ======== * `Contents <#contents>`__ * `MQTT Publisher <#mqtt-publisher>`__ * `Usage <#usage>`__ MQTT Publisher -------------- The MQTT publisher is a tool to help publish the sample sensor data. Usage ^^^^^ .. note:: This assumes you have already installed and configured Docker. #. Provision, build and bring up the EII stack by following the steps in the `README `_. **Note:** By default, the tool publishes temperature data. If the user wants to publish other data, he or she needs to modify the command option in "ia_mqtt_publisher" service in build/docker-compose.yml(\ ``[WORK_DIR]/IEdgeInsights/build/docker-compose.yml``\ ) accordingly and recreate the container using ``docker-compose up -d`` command from the build directory. * To publish temperature data to the default topic, the command option by default is set to: .. code-block:: sh ["--temperature", "10:30"] * To publish temperature and humidity data together, change the command option to: .. code-block:: sh ["--temperature", "10:30", "--humidity", "10:30", "--topic_humd", "temperature/simulated/0"] * To publish multiple sensor data sets (temperature, pressure, humidity) to the default topic (temperature/simulated/0, pressure/simulated/0, humidity/simulated/0), change the command option to: .. code-block:: sh ["--temperature", "10:30", "--pressure", "10:30", "--humidity", "10:30"] * To publish a different topic instead of the default topic, change the command option to: .. code-block:: sh ["--temperature", "10:30", "--pressure", "10:30", "--humidity", "10:30", "--topic_temp", , "--topic_pres", , "--topic_humd", ] In a single topic, it is possible to publish more than one sensor data. In that case, the same topic name needs to be given for that sensor data. * For publishing data from csv row by row, change the command option to: .. code-block:: sh ["--csv", "demo_datafile.csv", "--sampling_rate", "10", "--subsample", "1"] * To publish JSON files (to test random forest UDF), change the command option to: .. code-block:: sh ["--topic", "test/rfc_data", "--json", "./json_files/*.json", "--streams", "1"] #. If one wishes to see the messages going over MQTT, run the subscriber with the following command: .. code-block:: sh ./subscriber.sh Example: If Broker runs at port 1883, to run subscriber, use the following command: .. code-block:: sh ./subscriber.sh 1883