Repository navigation
Forward reset and replay handling through the platform wrapper - #197
Conversation
AxoniqPlatformEventHandlingComponent wraps the event handling component of every pooled streaming and subscribing processor. It forwarded only event handling, so the EventHandlingComponent defaults applied for the rest: - supportsReset() always returned true, so a processor accepted resetTokens() and sent replayed events to components that do not support a reset. - handle(ResetContext) returned an empty stream, so reset handlers never ran. A projection that clears its tables in a reset handler replayed on top of its old data. - handle(ReplayStatusChanged) returned an empty stream, so replay status handlers never saw a replay start or end. The wrapper now forwards supportsReset, both reset and replay status handle methods, supports and unwrap to the wrapped component. This follows the framework's DelegatingEventHandlingComponent. The wrapper does not extend that class, because its protected delegate field clashes with the public delegate property that DeadLetterManager reads.
stefanmirkovic
left a comment
There was a problem hiding this comment.
LGTM. The wrapper now forwards all five default methods, the same set DelegatingEventHandlingComponent overrides, and the three tests fail on main and pass here (ran them locally).
One thing worth a line in the release notes: the DLQ component sits below this wrapper and clearOnReset defaults to true, so with this fix a reset now clears the dead-letter queue. Until now dead letters survived resets for everyone using the client, including resets triggered from the Platform UI. It’s the correct framework behaviour, but users will notice. A test for that path would be nice too.
Nit: the third test calls the wrapper directly rather than going through a processor, so the PR description is slightly off there.
The dead-letter component sits below the platform wrapper. Now that the wrapper forwards resets, a reset clears the dead-letter queue when clearOnReset is true, which is the default. Cover both settings of clearOnReset so this behaviour change stays deliberate.
Problem
The client wraps the event handling component of each pooled streaming and subscribing processor in
AxoniqPlatformEventHandlingComponent. The wrapper forwards only event handling. For the other methods, theEventHandlingComponentdefaults apply. This has three effects in 5.4.0:resetTokens(), also when no component supports a reset. During the replay, the processor also sends events to those components.Change
The wrapper now forwards these methods to the wrapped component:
supportsResethandle(ResetContext, ProcessingContext)handle(ReplayStatusChanged, ProcessingContext)supportsunwrapThis follows the framework's
DelegatingEventHandlingComponent. The wrapper does not extend that class. Its protecteddelegatefield clashes with the publicdelegateproperty thatDeadLetterManagerreads.Tests
AxoniqPlatformEventHandlingComponentResetTesthas five tests:clearOnResetisfalse.The third test calls the wrapper directly. The other tests start a pooled streaming processor with the wrapper. The last two tests also turn on the dead-letter queue.
All five tests fail on
mainand pass with this change. The full suite passes, except for the fourAxoniqConsoleRSocketClientToxiproxyIntegrationTesttests. These tests also fail onmainin my environment.Note
The dead-letter component sits below this wrapper.
clearOnResetistrueby default. With this change, a reset clears the dead-letter queue. This also applies to a reset from the Platform UI. In 5.4.0, dead letters stayed after a reset. This is the correct framework behaviour, but users will notice it. The release notes must say so. To keep dead letters, setclearOnReset(false)on theDeadLetterQueueConfiguration.#196 also adds the
supportsforwarding. The second PR to merge gets a small conflict.