You now set up an endpoint to receive events. The endpoint validates input, persists the event, and enqueues processing.Documentation Index
Fetch the complete documentation index at: https://launchpad.datalumina.com/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint Implementation
The implementation below creates a simple POST endpoint without authentication (for demonstration purposes):This router is mounted at
/events by app/launchpad/api/router.py, so the full path is POST /events/. The body is accepted as a raw dict and validated later by the workflow against CustomerCareEventSchema (the event_schema on CustomerCareWorkflow). This keeps a single endpoint usable for multiple registered workflows.Key Actions Performed
Data validation
FastAPI parses the request body as JSON, then stores it. The workflow itself validates against
CustomerCareEventSchema when it runs, raising a validation error if the payload is malformed.Database storage
The event is stored with raw JSON, the workflow type from the registry, a generated ID, and timestamps.
Task queuing
A Celery task named
process_incoming_event is queued with the event ID and returns a task ID for tracking.Understanding the Components
- GenericRepository: Provides database operations (create, read, update, delete) for any model
- db_session: FastAPI dependency that provides a database session for the request
- celery_app: The Celery application instance for queuing background tasks
- WorkflowRegistry: Enum containing all registered workflows in the system