Vehicle Violation Notifications
Turn events from roadside devices into penalty notices while the vehicle-owner lookup service is frequently unavailable.
Problem statement
Design a system that receives vehicle violations from physical roadside boxes and informs the vehicle’s owner about the penalty. The public API that maps a number plate to owner data is down 50% of the time.
For this exercise, assume each device event includes a device ID, stable event ID, plate, observation time, and validated penalty details. Image recognition, penalty calculation, appeals, payment collection, and enforcement are outside scope. Devices may retry or upload a burst after reconnecting.
Once the service acknowledges an event, it must preserve it until a notice outcome or an explicit operator resolution is recorded.
For this exercise, operate in one country and use the lookup provider as the authority for the intended contact. A successful owner lookup may be reused for at most 5 minutes. An expired entry, timeout, or missing owner is not permission to guess a recipient.
Keep unresolved violations inspectable and notify the owner when the required data is available.
Assume the notification provider accepts a stable request key and offers a result lookup. A call may time out after the provider accepted it. Suppress duplicate logical notices, preserve uncertain outcomes, and explain how recovery determines what happened.
Do not claim that a local database transaction guarantees exactly-once physical message delivery.
For this exercise, check the five-minute owner-data limit at the first actual notification submission, even if the notice waited in a queue. Once a request may have been accepted by the provider, keep its recipient, payload, and request key unchanged while reconciling that request.
Only a definitely unsubmitted or rejected request may be replaced by a guarded new request revision with refreshed owner data.
What to build
- Validate and durably accept each device event once, with a stable way to inspect its processing state.
- Resolve the intended owner contact through the unreliable plate lookup API, reusing only results within the stated freshness limit.
- Send one logical penalty notice per violation and track accepted, confirmed, failed, and uncertain provider outcomes.
- Retain unresolved work through outages and support bounded automatic recovery plus an explicit operator resolution.
At scale
- For this exercise, assume one million violations per day from 20,000 devices, with reconnect bursts reaching 2,000 events per second.
- The owner API allows at most 100 requests per second across this service. Its 50% unavailability may include long outages; do not model every request as an independent coin flip.
- Target ingestion p95 below 300 ms after a durable commit. With healthy dependencies and no overload, target notice submission within 5 minutes; show backlog age and unresolved counts during outages.
- Accepted events must survive one application-node failure. Duplicate device uploads, retried lookups, and retried notification requests must not create another logical violation or notice.