Smart Experiences Architecture¶
Overview¶
Smart Experiences are DAG-based orchestration of service instances with context-aware composition, real-time state management, and bidirectional communication.
Key Concepts¶
Experience Structure¶
An experience consists of: - Customer: The customer booking the experience - Service Instances: Instances of partner services - Service Edges: Dependencies between services (DAG structure) - Context: Multi-dimensional context (temporal, spatial, social, environmental)
DAG Orchestration¶
Services are orchestrated as a Directed Acyclic Graph (DAG):
- Sequential: Service B depends on Service A completing
- Parallel: Services can run concurrently
- Conditional: Service execution depends on conditions
State Management¶
Service instances progress through states: - PENDING: Waiting for dependencies - CONFIGURED: Dependencies satisfied, ready to start - ACTIVE: Currently executing - SUSPENDED: Temporarily paused - COMPLETED: Successfully completed - FAILED: Execution failed - CANCELLED: Cancelled before completion
Context-Aware Composition¶
Experiences can be composed based on: - Temporal Context: Time of day, day of week, season, duration - Spatial Context: Location, coordinates, proximity - Social Context: Number of participants, group type - Environmental Context: Weather, noise level, temperature
Bidirectional Communication¶
Real-time communication channels: - Experience Rooms: WebSocket rooms for experience-specific communication - Partner Rooms: WebSocket rooms for partner-specific communication - Admin Channel: Broadcast channel for admin notifications
Implementation¶
See services/experience-service/ for experience orchestration implementation.
See services/notification-service/src/modules/notifications/gateways/notifications.gateway.ts for WebSocket communication.