Bookings & State Machine
The Scheduler service (zs-bullmq) manages two state machines that drive meeting space availability and booking lifecycle.
Room State Machine
Tracks the immediate physical state of a meeting room.
| State | Meaning |
|---|---|
free | Room is empty and available |
upcoming | A booking is about to start |
occupied | Room is currently in use |
cleaning | Post-meeting cleaning period |
Space State Machine
Tracks the scheduling status of a meeting space, accounting for business hours and booking windows.
States
| State | Meaning |
|---|---|
available_now | Free with no upcoming booking |
available_at | Free now but has an upcoming booking |
reserved | Booking start time reached; waiting for check-in |
in-maintenance | Space is in maintenance mode |
not_available | Outside business hours |
Events
| Event | Trigger |
|---|---|
BOOKING_CREATED | New booking is confirmed |
START_TIME_REACHED | Booking start time arrives |
USER_CHECKS_IN | User checks into the space |
NO_SHOW_TIMEOUT | User fails to check in within grace period |
USER_CHECKS_OUT | User ends their session early |
END_TIME_REACHED | Booking end time arrives |
BOOKING_CANCELLED | Booking is cancelled |
ADMIN_DISABLE | Admin puts space in maintenance |
ADMIN_ENABLE | Admin re-enables the space |
DAY_START | Business hours begin |
DAY_END | Business hours end |
Scheduler Queues
The Scheduler uses three BullMQ queues:
| Queue | Purpose |
|---|---|
meetingScheduler | State transition jobs (delayed, fire at exact times) |
statusUpdateQueue | External status HTTP posts back to ZenCore |
webhookDeliveryQueue | Outbound webhook delivery with retry |
Booking Lifecycle
- Create — User creates a booking via API or UI
- Schedule — ZenCore sends scheduling jobs to BullMQ
- T-15 min —
booking.startwebhook fires; ZenEdge issues magic links and device credentials - T-0 —
START_TIME_REACHEDevent; space moves toreserved - Check-in — User checks in; room moves to
occupied - End — Booking time expires or user checks out; room enters
cleaning - Reset — Cleaning period ends; room returns to
free
Next Steps
- Virtual vs Physical Spaces — Understanding the dual-space model
- Webhooks & Events — Event-driven architecture