# Phoenix Event Bus

**Category**: PLATFORM_SERVICES  
**Publisher**: Phoenix Cloud Services  
**Status**: PUBLISHED  
**Version**: 1.0.0

## Overview

Phoenix Event Bus provides durable event streaming with replay, versioning, and consumer idempotency. Implements DB Outbox pattern for atomic state + event writes. Supports Kafka, Redpanda, and NATS backends.

## Key Features

- **DB Outbox pattern**: Atomic state + event writes
- **Event versioning**: Schema evolution support
- **Consumer idempotency**: Exactly-once processing
- **Replay support**: Replay events from any point
- **Multiple backends**: Kafka, Redpanda, NATS
- **Offset tracking**: Consumer offset management
- **Correlation ID support**: End-to-end request tracking

## API Endpoints

### Publish Event

```http
POST /events/publish
Content-Type: application/json

{
  "eventType": "user.created",
  "aggregateId": "user_123",
  "payload": {
    "email": "user@example.com"
  },
  "correlationId": "req_456"
}
```

### Consume Events

```http
GET /events/consume?consumerId=consumer_123&eventType=user.created&limit=100
```

### Replay Events

```http
POST /events/replay
Content-Type: application/json

{
  "eventType": "user.created",
  "fromTimestamp": "2024-01-01T00:00:00Z",
  "toTimestamp": "2024-12-31T23:59:59Z"
}
```

## Pricing

- **Model**: Subscription-based
- **Base Price**: $149/month
- **Per GB Storage**: $0.10
- **Per Million Events**: $5.00

## Compliance

- SOC 2 Type II

## SLA

- **Uptime**: 99.95%
- **Latency**: <100ms p95

## Architecture

- Database outbox table
- Background workers for processing
- Event versioning schema
- Consumer offset tracking
