Skip to content

Smart Services Architecture

Overview

Smart Services are declarative service definitions with lifecycle hooks, state management, and extensible parameters. They enable partners to define services that can be orchestrated into experiences.

Key Concepts

Service Definition

A service definition includes: - Name and Type: Identifies the service (ACCOMMODATION, TRANSPORT, ACTIVITY, etc.) - Parameters: Service-specific configuration (JSONB) - Lifecycle Hooks: Executable hooks for service lifecycle events - Status: DRAFT, ACTIVE, SUSPENDED

Lifecycle Hooks

Lifecycle hooks are executed at specific points in a service instance's lifecycle:

  • onStart: Executed when service instance transitions to ACTIVE
  • onEnd: Executed when service instance completes
  • onSuccess: Executed when service instance completes successfully
  • onFailure: Executed when service instance fails
  • onSuspend: Executed when service instance is suspended
  • onResume: Executed when service instance resumes from suspended

Hook Types

  • API: HTTP POST request to specified endpoint
  • Script: Script execution (future implementation)

Implementation

See services/partner-service/src/modules/partner-services/ for service definition management.

See services/experience-service/src/modules/orchestration/lifecycle-hook-executor.service.ts for hook execution.