feat: add MQTT topic parsing and pipeline config
This commit is contained in:
1
backend/app/mqtt/__init__.py
Normal file
1
backend/app/mqtt/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""MQTT ingestion pipeline package."""
|
||||
10
backend/app/mqtt/topic.py
Normal file
10
backend/app/mqtt/topic.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import re
|
||||
|
||||
TOPIC_PATTERN = re.compile(r"^terminal/(?P<device_id>[^/]+)/raw$")
|
||||
|
||||
|
||||
def extract_device_id(topic: str) -> str:
|
||||
match = TOPIC_PATTERN.match(topic)
|
||||
if match is None:
|
||||
raise ValueError("topic must match terminal/{device_id}/raw")
|
||||
return match.group("device_id")
|
||||
Reference in New Issue
Block a user