feat(dx): support multiple domain event handlers via pg-boss pub/sub - #3475
feat(dx): support multiple domain event handlers via pg-boss pub/sub#3475stalniy wants to merge 1 commit into
Conversation
Domain events previously mapped 1:1 to a single queue and handler, so an event could not be consumed by more than one handler. Switch domain event delivery to pg-boss publish/subscribe: each handler owns its own queue and subscribes to the event, so handlers fail, retry, and restart in isolation and can be made idempotent independently. - Add JobQueueService.publish() (pgBoss.publish) and registerEventHandlers() which creates a per-handler queue and subscribes it to the event - Add EventHandler interface with an optional queue suffix; the queue defaults to the event name to preserve in-flight jobs on rollout - Route DomainEventsService.publish through the new publish path - Migrate existing event handlers to EventHandler and split job registration into commands (send) vs events (publish/subscribe) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3475 +/- ##
==========================================
- Coverage 72.87% 71.79% -1.08%
==========================================
Files 1133 1043 -90
Lines 29484 27148 -2336
Branches 7389 6929 -460
==========================================
- Hits 21487 19492 -1995
+ Misses 7042 6731 -311
+ Partials 955 925 -30
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
Why
Closes #1846
What
Domain events previously mapped 1:1 to a single queue and handler, so an event could not be consumed by more than one handler. Switch domain event delivery to pg-boss publish/subscribe: each handler owns its own queue and subscribes to the event, so handlers fail, retry, and restart in isolation and can be made idempotent independently.