SERVICE

MQTT Engine

MQTT for the Cams device fleet. The MQTT Engine is a backend consumer behind EMQX that subscribes to shared attendance and presence topics, funnels events into the same attendance pipeline as the HTTP and TCP transports, and publishes server-to-device command envelopes.

Overview

An MQTT transport engine that ingests attendance events and pushes device commands over an EMQX broker โ€” built for large connected fleets.

The MQTT Engine is the MQTT transport in the Cams engine family, the counterpart to HTTP and persistent TCP. It runs as a backend consumer behind an EMQX broker: it subscribes the shared attendance and presence topics under api/mqtt/v1/{sn}/, funnels each event into the shared pipeline, and publishes server-to-device commands on the command topic as forward-compatible JSON envelopes. EMQX terminates device TLS sessions, auth, QoS, and last-will; multiple engine instances load-balance via EMQX shared subscriptions for large fleets.

SERVICEMQTTEMQXTLSJSONC++
MQTT topic scheme (EMQX)
# device -> server (attendance)
api/mqtt/v1/{sn}/evt   { "user_id":"1001", "att_time":"...", "att_state":1 }
# device -> server (presence / LWT)
api/mqtt/v1/{sn}/st    { "online": true }
# server -> device (command)
api/mqtt/v1/{sn}/cmd   { "id":"c1", "op":"sync_user", "data":{} }

Capabilities

What it does

Ingest over MQTT

Subscribes the shared event topics and funnels each attendance event into the same storage and push pipeline as HTTP and TCP.

Track Presence

Consumes the presence topic and last-will so broker-detected disconnects mark a device offline.

Push Commands

Publishes queued server-to-device commands on the per-device command topic as JSON envelopes at QoS 1.

Horizontal Scale

EMQX shared subscriptions load-balance attendance across multiple engine instances for large device fleets.

Features

Everything included

  • MQTT transport front-end for attendance, peer to the HTTP and native TCP engines
  • Topic scheme api/mqtt/v1/{sn}/{evt|cmd|st} aligned with the app and EMQX ACL
  • Backend consumer behind EMQX: shared subscriptions load-balance across N instances
  • Ingests attendance events identical in payload to the HTTP punch body into the shared pipeline
  • Presence and last-will via the status topic so disconnects mark devices offline
  • Server-to-device command push as a forward-compatible {id, op, data} JSON envelope at QoS 1
  • TLS to the broker with CA verification; the engine uses a backend account, not a device serial
  • Cross-platform build (Linux and Windows) on Eclipse Paho C++

Build with MQTT Engine

Grab a key, read the docs, and ship. Our team helps with your first integration.

FAQ

Common questions

How does the MQTT Engine relate to EMQX?

EMQX stays the broker that terminates device TLS sessions, auth, QoS, and last-will. The MQTT Engine is a backend consumer that subscribes shared topics to ingest attendance and publishes commands to devices.

Can I run multiple MQTT Engine instances?

Yes. EMQX shared subscriptions load-balance the attendance and presence topics across all running instances, so you scale by adding instances.

What is the server-to-device command format?

A JSON envelope {id, op, data} on the command topic at QoS 1, where op is the only required field and unknown ops are ignored by older devices for forward compatibility.

Related

Explore more of the platform