Skip to content

Check projector active state using a specialized event publisher#474

Merged
erikrozendaal merged 4 commits intomasterfrom
simplify-active-projector-state-checking
Jul 7, 2025
Merged

Check projector active state using a specialized event publisher#474
erikrozendaal merged 4 commits intomasterfrom
simplify-active-projector-state-checking

Conversation

@erikrozendaal
Copy link
Copy Markdown
Member

This simplifies the projector logic as all projector state tracking is now only checked by the ActiveProjectorsEventPublisher. Replay now uses the normal EventPublisher so the logic to determine if an event is allowed to be processed by a projector can be simplified.

  • Should we remove the enable_projector_states flag and just require the user to configure the event publisher as ActiveProjectorsEventPublisher?

This simplifies the projector logic as all projector state tracking is
now only checked by the `ActiveProjectorsEventPublisher`. Replay now
uses the normal `EventPublisher` so the logic to determine if an event
is allowed to be processed by a projector can be simplified.
@erikrozendaal erikrozendaal requested review from lvonk and mvandiepen July 4, 2025 06:42
Since the event publisher used for replay no longer requires reading
the `projector_states` table within the same transaction as updating
the projectors the transaction is no longer needed.

Adding the transaction also causes problems with (potential)
deadlocks, since projectors might update multiple rows inside the same
transaction during replay using multiple parallel processes.
When using the active projectors publisher the check if a projector is
active and publishing the events must be inside a single transaction
to ensure consistency.
Copy link
Copy Markdown
Contributor

@mvandiepen mvandiepen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Co-authored-by: Lars Vonk <lars.vonk@gmail.com>
@erikrozendaal erikrozendaal merged commit 54b77de into master Jul 7, 2025
5 checks passed
@erikrozendaal erikrozendaal deleted the simplify-active-projector-state-checking branch July 7, 2025 07:02
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.

3 participants