Skip to content

Commands and Jobs

EMQX Fleets provides two mechanisms for sending operations to devices: Commands and Jobs. They serve different interaction patterns and have different delivery guarantees.

Commands vs Jobs

CommandsJobs
Interaction patternReal-time request-responseAsync batch dispatch with per-device tracking
TargetA single deviceOne or more devices or a Thing Group
DeliveryImmediate, requires device to be onlineQueued, device picks up on reconnect
Execution trackingSingle execution record with statusPer-device execution record with full lifecycle
TimeoutYes (configurable per command)Job-level and per-step timeouts
Typical useTrigger an action now (lock, unlock, reboot)Roll out a change to a fleet (firmware update, config push)

Commands

A Command is a real-time interaction with a single connected device. Fleets publishes the command request to the device over MQTT and waits for a response. The execution starts in SENT state and transitions to a terminal status (SUCCEEDED, FAILED, REJECTED, TIMED_OUT, or CANCELED) once the device responds or the TTL expires.

Commands are appropriate when:

  • The device must be online to receive the operation
  • You need an immediate response
  • The operation targets one device

See Send Commands for details.

Jobs

A Job is an asynchronous operation dispatched to one or more devices. Devices receive a notification when a job is pending, then pull the job document, execute it, and report their status back to Fleets. Each target device has its own execution record with an independent status.

Jobs are appropriate when:

  • You need to push an operation to many devices
  • Devices may be intermittently offline (jobs are queued and delivered on reconnect)
  • You need to track per-device execution progress over time

See Manage Jobs for details.

Execution Statuses

Command Execution Statuses

StatusMeaning
SENTCommand published to the device; awaiting response
SUCCEEDEDDevice responded with a successful result
FAILEDDevice responded with a failure
REJECTEDDevice rejected the command
TIMED_OUTNo response received within the timeout window
CANCELEDCommand was canceled

Job Execution Statuses

StatusMeaning
QUEUEDJob is pending, waiting for the device to pick it up
IN_PROGRESSDevice has started the job
SUCCEEDEDDevice reported successful completion
FAILEDDevice reported failure
REJECTEDDevice rejected the job
TIMED_OUTDevice did not complete the job within the timeout
CANCELEDExecution was canceled by the cloud
REMOVEDExecution record was deleted

Next Steps