refacto: reorganize folder tree to split lora gateway stack from app

Those stack won't necessarily be on the same host, so they need to be
split
This commit is contained in:
Alexis Fourmaux 2026-05-08 12:17:03 +02:00
parent 31a1c14831
commit 851e8947bc
11 changed files with 9 additions and 11 deletions

30
app/consumer/main.py Normal file
View file

@ -0,0 +1,30 @@
import paho.mqtt.client as mqtt
import logging
import sys
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
datefmt="%Y-%m-%dT%H:%M:%S",
stream=sys.stdout, # Docker lit stdout par défaut
force=True
)
log = logging.getLogger(__name__)
def on_connect(client, userdata, flags, reason_code, properties):
log.info(f"Connected with result code {reason_code}")
client.subscribe("application/+/device/+/event/up")
def on_message(client, userdata, msg):
log.info(msg.topic+" "+str(msg.payload))
if __name__ == "__main__":
mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
mqttc.on_connect = on_connect
mqttc.on_message = on_message
mqttc.connect("mosquitto", 1883, 60)
mqttc.loop_forever()