Skip to content

fix(eventsourcingdb): separate handler retries from observer reconnects#56

Merged
dgoerdes merged 3 commits into
mainfrom
feature/esdb-observer-retry-fix
Jul 17, 2026
Merged

fix(eventsourcingdb): separate handler retries from observer reconnects#56
dgoerdes merged 3 commits into
mainfrom
feature/esdb-observer-retry-fix

Conversation

@dgoerdes

Copy link
Copy Markdown
Contributor

Handler failures no longer tear down the observe stream. Retry them
in-place, skip after exhaustion (optional onHandlerError), and keep
connectionRetryOptions for stream reconnects. Deprecate retryOptions
as an alias for connection retries.

Copilot AI review requested due to automatic review settings July 17, 2026 12:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the EventSourcingDB event observer so that handler failures are retried in-place (without tearing down the observe stream), while connection/stream failures use separate reconnect retry options. It also deprecates retryOptions as an alias for connection retries and updates tests + docs to cover the new behavior.

Changes:

  • Split observer retry configuration into connectionRetryOptions (stream reconnects) and handlerRetryOptions (in-place handler retries), with optional onHandlerError after handler retry exhaustion.
  • Export and use observeWithRetry for an awaitable observation loop; initEventObserver remains the background/non-blocking entry point.
  • Extend integration tests and update docs/examples/README to describe the new retry model and the deprecated option.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/eventsourcingdb/src/lib/integration.test.ts Adds coverage for handler in-place retries, poison event skipping, and connection retry exhaustion/reconnect behavior.
packages/eventsourcingdb/src/lib/eventObserver.ts Implements separate connection vs handler retry paths; adds onHandlerError; exports observeWithRetry.
packages/eventsourcingdb/src/lib/client.ts Updates setup JSDoc example to use connectionRetryOptions + handlerRetryOptions.
packages/eventsourcingdb/README.md Updates user-facing documentation for split retry behavior and deprecates retryOptions.
examples/eventsourcing-demo/src/eventsourcingdb.ts Adds an example observer demonstrating handler retry + onHandlerError usage.
docs/guide/eventsourcingdb/event-observer.md Updates the guide to document the new options and behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eventsourcingdb/src/lib/integration.test.ts Outdated
Comment thread packages/eventsourcingdb/src/lib/eventObserver.ts
Comment thread docs/guide/eventsourcingdb/event-observer.md
Comment thread docs/guide/eventsourcingdb/event-observer.md
Comment thread examples/eventsourcing-demo/src/eventsourcingdb.ts
Comment thread examples/eventsourcing-demo/src/eventsourcingdb.ts Outdated
Comment thread packages/eventsourcingdb/README.md
@sonarqubecloud

Copy link
Copy Markdown

@dgoerdes
dgoerdes merged commit 3e6e357 into main Jul 17, 2026
7 checks passed
@dgoerdes
dgoerdes deleted the feature/esdb-observer-retry-fix branch July 17, 2026 13:12
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants