Skip to content

Replace getEventById with EventQuery for event retrieval#41

Merged
vanrogu merged 2 commits intodevelopfrom
claude/check-geteventbyid-usage-Aeior
Feb 22, 2026
Merged

Replace getEventById with EventQuery for event retrieval#41
vanrogu merged 2 commits intodevelopfrom
claude/check-geteventbyid-usage-Aeior

Conversation

@vanrogu
Copy link
Member

@vanrogu vanrogu commented Feb 22, 2026

Summary

Refactored event retrieval logic to use the EventQuery API instead of the deprecated getEventById method across banking examples.

Key Changes

  • Replaced eventStream.getEventById() calls with eventStream.query(EventQuery.forEvents(...)) pattern in two example classes
  • Added imports for Tags, EventQuery, and EventTypesFilter to support the new query-based approach
  • Updated event filtering to use EventTypesFilter.of(AccountOpened.class) for type-safe filtering
  • Added explicit .findFirst() call to retrieve the first matching event from the query results
  • Maintained the same filtering logic by adding .filter(e -> e.reference().id().equals(ref.get().id())) to match the original behavior

Implementation Details

The changes modernize the event retrieval pattern by:

  1. Using the more flexible EventQuery API that supports filtering by event types and tags
  2. Leveraging streams and functional composition for event lookup
  3. Maintaining backward compatibility in behavior while using the newer query infrastructure

https://claude.ai/code/session_01LPcFaA1bRJrcZjP4Rh3Mwe

The eventmodeling library no longer calls getEventById from the
eventstore library. The two example apps now query all AccountOpened
events and filter by event ID instead.

https://claude.ai/code/session_01LPcFaA1bRJrcZjP4Rh3Mwe
@vanrogu vanrogu merged commit dde3c34 into develop Feb 22, 2026
vanrogu added a commit that referenced this pull request Feb 22, 2026
* Replace getEventById usage with query-based event lookup in examples

The eventmodeling library no longer calls getEventById from the
eventstore library. The two example apps now query all AccountOpened
events and filter by event ID instead.

https://claude.ai/code/session_01LPcFaA1bRJrcZjP4Rh3Mwe

* fixed examples by adding bounded context start

---------

Co-authored-by: Claude <noreply@anthropic.com>
@vanrogu vanrogu deleted the claude/check-geteventbyid-usage-Aeior branch February 22, 2026 14:52
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.

2 participants