Question
Design a service that ingests telemetry from many devices, detects meaningful state changes, and triggers control actions according to configurable rules. Cover the ingestion API, event schema, message transport, stream processing, state storage, rule evaluation, and command-delivery path. Explain how the system handles bursty traffic, duplicate and out-of-order events, intermittent device connectivity, failed control commands, and service recovery. Define the latency and consistency guarantees you would offer, the metrics needed to operate the system, and the safeguards that prevent unstable feedback loops. ## Follow-ups 1. Support devices that remain offline for days and later upload buffered telemetry. 2. Roll out a new rule version without evaluating one event under two policies. 3. Add an emergency stop that overrides automated control safely.