Event System
Quark Commerce publishes domain events via a transactional outbox pattern to RabbitMQ. This enables asynchronous processing by external services.
How It Works
- When a business operation occurs (e.g., order placed), an event is written to the
OutboxMessagestable in the same database transaction - A background service (
OutboxPublisherService) polls the outbox table - Pending messages are published to RabbitMQ via the
quark.eventstopic exchange - Messages are routed with keys like
events.OrderPlaced,events.ProductCreated - External worker services subscribe to events they care about
Event Categories
| Category | Events |
|---|---|
| Order | OrderPlaced, OrderStatusChanged, OrderCancelled |
| Product | ProductCreated, ProductUpdated, ProductDeleted |
| Inventory | InventoryChanged |
| Fulfillment | FulfillmentStatusChanged |
| Supply Chain | PurchaseOrderCreated, PurchaseOrderStatusChanged, PurchaseOrderSent, PurchaseOrderCancelled, GoodsReceived |
Monitoring
Outbox Monitor
Navigate to Settings → Event System to view:
- Pending messages (not yet published)
- Published messages
- Failed messages (with error details)
- Retry counts
Event Activity Log
The system logs every event publish attempt:
- Event type and payload
- Success/failure status
- Timestamps
- Error messages (for failures)
Click an event to view its full JSON payload.
Configuration
Event publishing is configured in appsettings.json under the RabbitMQ section:
| Setting | Description | Default |
|---|---|---|
OutboxDeliveryIntervalSeconds | Polling interval | 5 |
MaxRetryCount | Max attempts before marking failed | 5 |
Event Configuration
Navigate to Settings → Event Configuration to manage which events are enabled and their routing configuration.
info
Events are published but not consumed within the Quark API itself. Consumers live in separate worker services that you build and deploy independently. This keeps the monolith lean and allows specialized processing per event type.