fix: resolve the event store connection at call time - #13
Merged
Merged
Conversation
- SqlEventStore accepts a Closure(): PDO so add() joins whichever transaction the caller has open, instead of committing the event on a second session independently of the business change it describes - Add an optional schema so the outbox tables can be qualified when they live outside the calling connection's default schema - Resolve the connection once per method so a closure cannot hand back a different handle mid-transaction
jcviljoen
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SqlEventStoreaccepts aClosure(): PDOand resolves it on every call, soadd()joins whichever transaction the caller has open instead of writing the event on a second sessionPDOmeant the event row committed independently of the business change it described: a consumer could see the event before the row it referred to existed, or after that row rolled backschemaqualifies the outbox tables (platform.event_outbox) for when the inserting connection's default schema is not the outbox'sPDO, so existing consumers are unaffected🤖 Generated with Claude Code