Repository navigation
[DEV-1902] Add opt-in rich subscription liveness - #424
Conversation
PR Summary by QodoAllow clients to opt in to subscription FellBehind messages
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
f3718bf to
3c5de6c
Compare
KurrentDB 26.2.2 and later send FellBehind to subscriptions of clients that declare read compatibility level 2. KurrentDBClientSettings.EnableRichSubscriptionLiveness makes subscriptions declare that level. They then yield StreamCaughtUp / StreamFellBehind or AllStreamCaughtUp / AllStreamFellBehind, with the timestamp and checkpoint sent by the server. These derive from StreamMessage.CaughtUp / FellBehind, so code that matches the base messages keeps matching. StreamSubscriptionResult.Features tells whether a subscription has the feature: it is enabled and the node the subscription connected to supports it, which is detected from the version the node reports. KurrentDBClientBase.GetSettings() returns a copy of the client's settings, made by the new KurrentDBClientSettings.Clone(). Without the setting nothing changes: requests are the same, and CaughtUp is the same data-less instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3c5de6c to
4a81d9f
Compare
Opt-in richer liveness for subscriptions, built on the
FellBehindmessage that KurrentDB 26.2.2+ sends to clients declaring read compatibility level 2 (kurrent-io/KurrentDB#5750).Changes
KurrentDBClientSettings.EnableRichSubscriptionLiveness, defaultfalse. When on, subscriptions declare level 2.subscription.MessagesyieldsStreamCaughtUp/StreamFellBehind(Timestamp,StreamPosition) orAllStreamCaughtUp/AllStreamFellBehind(Timestamp,Position). They derive fromStreamMessage.CaughtUp/FellBehind, so existing matches still work.await subscription.FeaturesgivesStreamSubscriptionFeatures.RichLiveness: the setting is on and the node the subscription connected to reports 26.2.2 or later.client.GetSettings()andKurrentDBClientSettings.Clone().ServerCapabilitiesgains aSupportsSubscriptionFellBehindconstructor parameter.Compatibility
With the setting off, requests and messages are identical to before.
The
ServerCapabilitiesconstructor changes, as it did in 1.1.0 and 1.4.0: code that constructs that record needs recompiling.Tests
CaughtUptype andFeaturesare pinned.FellBehindat default settings.CaughtUpcarries timestamp and checkpoint with the setting on.FellBehindthenCaughtUp, with timestamp and checkpoint.No user docs yet.
🤖 Generated with Claude Code