Skip to main content

Event System

Quark Commerce publishes domain events via a transactional outbox pattern to RabbitMQ. This enables asynchronous processing by external services.

How It Works

  1. When a business operation occurs (e.g., order placed), an event is written to the OutboxMessages table in the same database transaction
  2. A background service (OutboxPublisherService) polls the outbox table
  3. Pending messages are published to RabbitMQ via the quark.events topic exchange
  4. Messages are routed with keys like events.OrderPlaced, events.ProductCreated
  5. External worker services subscribe to events they care about

Event Categories

CategoryEvents
OrderOrderPlaced, OrderStatusChanged, OrderCancelled
ProductProductCreated, ProductUpdated, ProductDeleted
InventoryInventoryChanged
FulfillmentFulfillmentStatusChanged
Supply ChainPurchaseOrderCreated, 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:

SettingDescriptionDefault
OutboxDeliveryIntervalSecondsPolling interval5
MaxRetryCountMax attempts before marking failed5

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.