Skip to content

Add FetchLatest() JSON streaming to HTTP via WriteLatest#4138

Merged
jeremydmiller merged 2 commits intomasterfrom
GH3864
Feb 16, 2026
Merged

Add FetchLatest() JSON streaming to HTTP via WriteLatest#4138
jeremydmiller merged 2 commits intomasterfrom
GH3864

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Add StreamLatestJson<T>() to IEventStoreOperations for streaming projected aggregate JSON directly to a Stream, bypassing deserialization/serialization for inline and caught-up async projections
  • Add WriteLatest<T>() extension methods to Marten.AspNetCore for writing aggregate JSON straight to HTTP responses (Guid and string overloads)
  • Implement lifecycle-specific optimizations: inline projections use raw JSONB streaming, async projections buffer raw JSONB when caught up, live projections rebuild and serialize

Closes #3864

Test plan

  • 6 new HTTP streaming tests in Marten.AspNetCore.Testing covering Guid and string identified aggregates (hit, miss, multiple events)
  • All 22 existing Marten.AspNetCore.Testing tests pass (28 total)
  • All 45 existing fetch_latest EventSourcingTests pass
  • Builds clean on net8.0

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits February 16, 2026 07:48
Add StreamLatestJson<T>() and WriteLatest<T>() APIs that stream projected
aggregate JSON directly to HTTP responses, avoiding deserialization/serialization
round-trips for inline and caught-up async projections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The snippet region was removed from archiving_events.cs but still
referenced in docs/diagnostics.md. Re-add it in DaemonTests where
the same pattern is used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Add support for aggregate FetchLatest() JSON streaming to HTTP

1 participant