Skip to content

FEATURE: Support limit in read() for subscription engine 2.0 - #3

Merged
bwaidelich merged 2 commits into
mainfrom
feature/bounded-catch-ups
Nov 3, 2026
Merged

bwaidelich merged 2 commits into
mainfrom
feature/bounded-catch-ups

Conversation

@bwaidelich

@bwaidelich bwaidelich commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

read() accepts the limit of the bounded catch-ups in bwaidelich/subscription-engine#13.

-public function read(Position $startPosition): iterable
+public function read(Position $startPosition, int|null $limit = null): iterable
 {
-    ReadOptions::create(from: $startPosition->value)
+    ReadOptions::create(from: $startPosition->value, limit: $limit)
 }
  • wwwision/subscription-engine is now ^1 || ^2. The optional parameter is compatible with the 1.x interface
  • Adds PHPUnit and the first tests for this package (against InMemoryEventStore)
  • minimum-stability: dev and prefer-stable: true let composer-studio link the local core. These settings only apply when this package is the root package

Evidence

  • Before: read(start: 2, limit: 2) ignores the limit, so test_read_with_limit_returns_at_most_limit_events_from_start_position fails
    After: OK (3 tests, 3 assertions), against both core 1.4.0 and the 2.0 branch

Driving the engine through this adapter on the core branch (5 events, boot(limit: 2)):

run: processed=2 pending=true status=BOOTING position=2
run: processed=2 pending=true status=BOOTING position=4
run: processed=1 pending=false status=ACTIVE position=5
handled: 1,2,3,4,5

This repository has no CI, so these are local runs.

Merge Danger

Door: two-way until tagged

Hold the tag until read() is final. A released adapter that allows ^2 would fail with a fatal error if the event filter follow-up changes the signature again.

Blast Radius: none

Existing callers don't pass $limit, so read() behaves as before for them.

@bwaidelich bwaidelich changed the title Feature/bounded catch ups FEATURE: Support limit in read() for subscription engine 2.0 Nov 3, 2026
@bwaidelich
bwaidelich merged commit 4f4e630 into main Nov 3, 2026
@bwaidelich
bwaidelich deleted the feature/bounded-catch-ups branch November 13, 2026 16: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.

1 participant