ScalixScalix Docs

Events

Pub/Sub event bus with topics, subscriptions, and webhook delivery

Overview

Scalix Events is a Pub/Sub system for event-driven architectures. Publish events to topics, subscribe with webhooks or functions, and track delivery with automatic retries.

CLI

bash
# Create a topic
scalix-cloud events topic create order-events
 
# Publish an event: <topic> <event_type> <json-data>
scalix-cloud events publish order-events order.created '{"order_id": "ord_123", "total": 99.99}'
 
# List topics
scalix-cloud events topics
 
# List subscriptions
scalix-cloud events subs

Subscriptions are created through the REST API (below) or the console — the CLI lists them.

REST API

Create a Topic

bash
curl -X POST https://api.scalix.world/v1/events/topics \
  -H "Authorization: Bearer $SCALIX_API_KEY" \
  -d '{"name": "order-events"}'

Publish an Event

bash
curl -X POST https://api.scalix.world/v1/events/topics/{topic_id}/publish \
  -H "Authorization: Bearer $SCALIX_API_KEY" \
  -d '{
    "event_type": "order.created",
    "data": {"order_id": "ord_123", "total": 99.99},
    "source": "checkout-service"
  }'

Subscribe

bash
curl -X POST https://api.scalix.world/v1/events/topics/{topic_id}/subscriptions \
  -H "Authorization: Bearer $SCALIX_API_KEY" \
  -d '{
    "sub_type": "webhook",
    "config": {"url": "https://myapp.com/webhooks/orders"},
    "filter": {"event_types": ["order.created"]},
    "max_retries": 5
  }'

Function Subscriptions

Trigger a Scalix Function when an event is published:

bash
curl -X POST https://api.scalix.world/v1/events/topics/{topic_id}/subscriptions \
  -H "Authorization: Bearer $SCALIX_API_KEY" \
  -d '{
    "sub_type": "function",
    "config": {"function_name": "process-order"},
    "filter": {"event_types": ["order.created"]}
  }'

Delivery

Events are delivered to subscribers with automatic retries:

  • Retry strategy: Exponential backoff
  • Max retries: Configurable (default: 3)
  • Delivery tracking: View attempt history, status codes, and response times
bash
curl https://api.scalix.world/v1/events/subscriptions/{sub_id}/deliveries \
  -H "Authorization: Bearer $SCALIX_API_KEY"