services/worker/README.md
The Time Machine service is an autonomous, generic service responsible for handling delayed events (timers). It replaces the previous Temporal implementation with a database-backed polling mechanism and Kafka-based communication.
TimeMachine Kafka topic.time_machine.delayed_events.data to the specified topic via Kafka and removes the record from its database.Topic: TimeMachine (timeMachine)
Message Type: TimeMachineMessage
| Type | Description |
|---|---|
schedule | Schedules a new timer or updates an existing one. Requires id, targetDate, topic, and data. |
cancel | Removes scheduled timers. The id supports pattern matching via ILIKE (e.g., prefix_%). |
Topic: Dynamic (specified in schedule command)
Message Type: Arbitrary JSON (stored in data)
When a timer expires, the service relays the exact data payload to the target topic.
| Variable | Default | Description |
|---|---|---|
DB_URL | postgres://localhost:5432/huly | Connection string for the PostgreSQL database. |
POLL_INTERVAL | 5000 | Polling interval for expired events in milliseconds. |
QUEUE_CONFIG | - | Kafka bootstrap servers configuration. |
QUEUE_REGION | cockroach | Platform region configuration. |
The service automatically initializes its own schema if it doesn't exist:
time_machinedelayed_eventsid (text), workspace (uuid), target_date (int8), topic (text), data (jsonb).(id, workspace)