mqtt-ingestion-worker
Responsibility
Section titled “Responsibility”services/mqtt-ingestion-worker is the single receiver for the Netmore sensor
feed. It converts the external MQTT envelope into RawIngestionEventV1 and
publishes that event once to the durable raw stream. It does not access the
database, resolve tenant authority, or execute a telemetry flow.
Startup order
Section titled “Startup order”- Validate all configuration and start the operations endpoint.
- Connect the publisher identity to NATS and confirm the expected stream exists.
- Connect to Netmore with MQTT 3.1.1 over TLS 1.2 or newer.
- Resume the environment-specific persistent session with
clean: false. - Subscribe to
sensor/sensor_network_services/+/payloadat QoS 1.
Readiness is successful only while both the MQTT subscription and JetStream publisher are available.
Message path
Section titled “Message path”For every publish packet the worker records bounded receipt metrics, then:
- rejects an unsupported topic, retained message, QoS, or oversized payload;
- drops configured customer topic segments before JSON parsing;
- preserves exact MQTT bytes and builds parsed or malformed event metadata;
- calculates the documented idempotency key;
- publishes JSON to
sens.ingestion.raw.v1with that key as the JetStream message ID; - waits for the JetStream persistence acknowledgement before allowing MQTT processing to complete.
If durable publish fails, the worker destroys the MQTT transport before PUBACK. Netmore can therefore redeliver the QoS 1 message after reconnect. This favors duplicate-safe recovery over silent loss.
Deployment and scaling
Section titled “Deployment and scaling”The worker is deployed with one replica and Recreate. Two active receivers
using the same feed and different session state could duplicate or partition
input unexpectedly. Horizontal scaling requires a new, explicitly reviewed
broker/session contract.
Failure diagnosis
Section titled “Failure diagnosis”| Readiness or metric | Meaning |
|---|---|
| MQTT disconnected | Credentials, TLS, DNS, broker reachability, or reconnect state. |
| Subscription inactive | Topic or QoS grant was not accepted. |
| JetStream unavailable | NATS auth, stream bootstrap, or NATS storage failure. |
| Publish failures increase | NATS persistence acknowledgement exceeded the timeout or failed. |
| Received grows but parsed does not | Customer filter or envelope discard rules are matching. |
Use Netmore Raw Ingestion for the live runbook and the MQTT contract for exact payload semantics.