[#4643] AggregateBasedJpaEventStorageEngine#stream loops until StreamingCondition matching events are retrieved#4684
Conversation
Adjust the AggregateBasedJpaEventStorageEngine#streaming to keep querying events until some match the given StreamingCondition. If we don't do this, there's a chance that the batch is empty, stalling the ContinuesMessageStream until a new event is appended. Thus, essentially blocking a consumer like the PooledStreamingEventProcessor, potentially indefinitely. #4625
AggregateBasedJpaEventStorageEngine#stream loops until StreamingCondition matching events are retrievedAggregateBasedJpaEventStorageEngine#stream loops until StreamingCondition matching events are retrieved
|
Tested the same way as #4681 — confirms it works !.
|
hatzlj
left a comment
There was a problem hiding this comment.
I have one suggestion to improve the readability, otherwise looks good to me
|
would be worth to run the |
Will do! |
Simplify loop by using a do-while i.o. while(true) #4643
Validated the new test to work for the |
This pull request adjusts the
AggregateBasedJpaEventStorageEngine#streamingmethod, to keep querying batches of events until some match the givenStreamingCondition.If we don't do this, there's a chance that the batch is empty, stalling the
ContinuousMessageStreamuntil it's nudged (e.g. when a new event is appended).Thus, the old approach essentially blocks a consumer like the
PooledStreamingEventProcessor, potentially indefinitely.This PR is a second try to resolve issue #4643, with the original PR being #4681.
This PR differs from #4681 as it's an
AggregateBasedJpaEventStorageEngineonly solution.This is by design, as Axon Server and our PostgreSQL
EventStorageEngineimplementations ensure the same: they loop through the event store until aStreamingConditionmatch is found.As all
EventStorageEnginessupport this, and should support this, a test has been added to theStorageEngineBackedEventStoreTestSuiteto validate the behavior that anEventStorageEngine#streamoperation will progress until a firstStreamingConditionmatch has been found.By doing the above, this PR works towards resolving #4643.
A port to
axon-5.1.xis still required, though.