ServerPub-Sub
Overview
Event-driven architecture for background processing, tenant provisioning, and data seeding.
The Pub-Sub feature handles asynchronous events in Selegic. It reacts to "Global" events (e.g., new organization) to perform background setup tasks.
Core Responsibilities
- Tenant Provisioning: Create database schemas when an organization is created
- Data Seeding: Populate tenant databases with metadata and demo data
- Asynchronous Decoupling: Return success while infrastructure work continues
- Idempotency: Ensure valid state even if events are processed twice
Architecture
Located in features/pub-sub:
| Component | Purpose |
|---|---|
startConsumer | Entry point on server boot |
OrganizationCreated | Schema creation, connection mapping |
OrganizationSeed | Initial data population |
Quick Navigation
- Consumer Bootstrap — Event listener initialization
- Provisioning Flow — Tenant creation lifecycle
- Runbook — Troubleshooting failed provisioning