Skip to content
SENS Platform Docs

Device Ingestion Architecture

This document defines the initial ingestion architecture for LoRaWAN telemetry messages delivered by the external Network Server over MQTT.

Network Server: Netmore.

The Network Server decrypts LoRaWAN data and publishes messages over MQTT.

Network Server -> MQTT -> mqtt-ingestion-worker -> internal stream -> telemetry-worker -> database

The MQTT ingestion worker must:

  • Connect to the configured MQTT broker.
  • Subscribe to configured topics.
  • Reconnect safely on disconnect.
  • Validate the minimal message envelope.
  • Attach ingestion metadata.
  • Publish messages to the internal stream.
  • Emit metrics and structured logs.
  • Avoid executing decoders.
  • Avoid direct long-term telemetry writes where practical.

The telemetry worker must:

  • Consume raw ingestion events.
  • Deduplicate messages where possible.
  • Match messages to devices.
  • Store raw payloads.
  • Run the configured decoder.
  • Store normalized measurements.
  • Record decoder failures.
  • Record unknown-device failures.
  • Handle delayed and out-of-order messages.
  • Send failed messages to a dead-letter flow when needed.

The platform must tolerate:

  • Duplicate messages.
  • Out-of-order messages.
  • Delayed messages.
  • Malformed payloads.
  • Unknown devices.
  • Decoder errors.
  • Temporary broker outages.
  • Temporary database outages.

The ingestion pipeline must use available identifiers for idempotency.

Possible idempotency inputs:

  • Network Server message ID.
  • DevEUI.
  • Frame counter.
  • Received timestamp.
  • Payload hash.
  • Source identifier.

The exact strategy must be defined after the Netmore MQTT payload is documented.

MQTT QoS must be documented before implementation.

QoS levels:

  • QoS 0 means at most once delivery.
  • QoS 1 means at least once delivery and duplicates are possible.
  • QoS 2 means exactly once at MQTT protocol level, but application-level idempotency is still recommended.

Unknown device messages must not crash ingestion.

They should be:

  • Stored or recorded according to retention rules.
  • Counted with metrics.
  • Logged safely.
  • Made visible to operators where useful.

Decoder failures must not stop the ingestion pipeline.

They should be:

  • Recorded with safe error details.
  • Counted with metrics.
  • Linked to device, device type, decoder version, and message ID where possible.
  • Available for operational troubleshooting.