outbox-pattern

Persist domain events with aggregates and process them via a scheduled background job.

69|13|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill outbox-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: outbox-pattern
Source: https://github.com/ronnythedev/dotnet-clean-architecture-skills/tree/main/sample/POS/.claude/skills/14-outbox-pattern
Command: npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill outbox-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Outbox pattern implementation ensures domain events are persisted in the same transaction as the aggregates and processed asynchronously with guaranteed delivery.

Core Features & Use Cases

  • Atomic persistence of domain events with aggregates
  • Background processing with guaranteed delivery and idempotent handlers
  • Easy integration with EF Core, MediatR, and Quartz
  • Use case: ensure user actions always produce events even in the event of system failures

Quick Start

Add domain events to the outbox by saving changes, then configure and start the Quartz-backed processing job to publish those events.

Frequently Asked Questions about outbox-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I persist domain events in the same transaction as aggregates?

To persist domain events atomically with aggregates, this skill uses an outbox table to save events within the same transaction, ensuring data consistency before background processing publishes them asynchronously.

What is the best way to guarantee domain event delivery during system failures?

Guaranteed domain event delivery is achieved by persisting events to an outbox table transactionally, then using a scheduled background job with retry logic and backoff to process and publish them until successful.

How do I process outbox messages with EF Core, MediatR, and Quartz?

You can process outbox messages by saving domain events via EF Core, triggering handlers through MediatR, and scheduling the background processing job using Quartz to ensure reliable asynchronous publication.

Why do I need idempotent handlers for background event processing?

Idempotent handlers are required for background event processing to prevent duplicate side effects during retries, ensuring that reprocessing an outbox message after a failure does not corrupt system state.

Does the outbox pattern support batch processing and cleanup?

Yes, the outbox pattern implementation supports batch processing of domain events and includes cleanup mechanisms for the outbox table to manage database growth after successful publication.

When should I use an outbox table for transactional systems?

You should use an outbox table in transactional systems when you need atomic persistence of domain events alongside aggregates, requiring guaranteed delivery through background processing without data loss.

Related Skills