Skip to content

module-12. add outbox - #14

Merged
s-aleshin merged 1 commit into
mainfrom
module-12
May 18, 2026
Merged

module-12. add outbox#14
s-aleshin merged 1 commit into
mainfrom
module-12

Conversation

@s-aleshin

@s-aleshin s-aleshin commented May 16, 2026

Copy link
Copy Markdown
Owner

feat(outbox): implement transactional domain event publishing. outbox pattern

  • Add OutboxMessage model, migrations, factories, and processor tests

  • Implement OutboxDomainEventPublisher and integration event processing job

  • Move domain event publishing under database transaction

  • Add DI configuration for OutboxDomainEventPublisher

  • Support publishing integration events to multiple Kafka topics

  • Enhance outbox payload serialization and message structure

  • Switch PostgreSQL driver from asyncpg to psycopg

  • Remove asyncpg and granian dependencies

  • Add unit tests for outbox and integration event publishers

  • Update UUID types to SQLAlchemy Uuid to avoid json serialization issues

  • Refactor domain events to use explicit serializable payloads and remove aggregate source references

NOTES
@kvetchinkin after our discussion of the events in the course chat I’ve made some refactoring which brings some noise to the PR. To simplify the review process, I listed the main changes that affect the module task below:

  1. OutboxMessage ORM model
  2. OutboxDomainEventPublisher - collects domain events from aggregates and stores them in the DB as OutboxMessage.
  3. OutboxMessageProcessor - callable class used by the background job to process outbox messages and publish them to Kafka.
  4. Background Job for procession outbox messages
  5. The background job connected to the scheduler
  6. Integration Events Publisher - tried to implement implemented as a more generic publisher, not tied to one specific aggregate.
image image

… pattern

* Add OutboxMessage model, migrations, factories, and processor tests
* Implement OutboxDomainEventPublisher and integration event processing job
* Move domain event publishing under database transaction
* Add DI configuration for OutboxDomainEventPublisher
* Support publishing integration events to multiple Kafka topics
* Enhance outbox payload serialization and message structure
* Update UUID types to SQLAlchemy Uuid
* Switch PostgreSQL driver from asyncpg to psycopg
* Remove asyncpg and granian dependencies
* Add unit tests for outbox and integration event publishers

* Refactor domain events to use explicit serializable payloads and remove aggregate source references
@s-aleshin
s-aleshin requested a review from kvetchinkin May 16, 2026 16:35
@s-aleshin s-aleshin changed the title module 12. add outbox module-12. add outbox May 16, 2026
@s-aleshin
s-aleshin merged commit e3ae52c into main May 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant