Skip to content

rust-community-pl/mqtt-consumer

Repository files navigation

Local MQTT server (mosquitto)

Configure the local MQTT user for the mqtt service

> docker compose run -it --rm mqtt sh
$ mosquitto_passwd -c /mosquitto/config/pwfile user
Password: foobar
Reenter password: foobar
$ exit

Set up MQTT credentials in the .env file

SUBSCRIBER_MQTT_HOSTNAME="127.0.0.1"
SUBSCRIBER_MQTT_PORT="1883"
SUBSCRIBER_MQTT_USERNAME="user"
SUBSCRIBER_MQTT_PASSWORD="foobar"
SUBSCRIBER_MQTT_USE_TLS="false"

To use a custom .env file, set SUBSCRIBER_ENV_FILE to the desired path.

Database

Upgrade to the latest version

alembic upgrade head

Generate migrations

alembic revision --autogenerate -m "What was changed?"

Consumer

Consume and save answers

python -m consumer

Publish sample messages

for SAMPLE_FILE in scripts/samples-*.txt
do
    python -m scripts.publish-samples $SAMPLE_FILE
done

Prune saved answers

python -m consumer prune

Tests

pytest

Accept docstring updates

pytest --accept

©️ 2025 Bartosz Sławecki

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages