core-java icon indicating copy to clipboard operation
core-java copied to clipboard

Make `UncommittedHistory` remember only successfully applied events

Open yevhenii-nadtochii opened this issue 3 years ago • 1 comments

This PR addresses #1313.

The issue appears when multiple messages are dispatched from Inbox. Under the hood, those messages are processed as a batch, which triggers Aggregate to be cached for their processing. Going this way, Aggregate puts applied events into UncommittedHistory to send them to a storage lately.

Now, events emitted by a single command are put into the history only if they all were applied successfully. This behavior matches to the one of non-cached Aggregate.

Additionally, initialization of Delivery was dropped out of ServerEnvironment.reset(). Delivery is lazily initialized the same way in its getter ServerEnvironment.delivery().

The library version is bumped to 2.0.0-SNAPSHOT.92.

yevhenii-nadtochii avatar Jan 04 '22 14:01 yevhenii-nadtochii

Codecov Report

Merging #1439 (8461f99) into master (c6b7be4) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #1439      +/-   ##
============================================
+ Coverage     91.41%   91.45%   +0.03%     
+ Complexity     4946     4944       -2     
============================================
  Files           622      622              
  Lines         15216    15196      -20     
  Branches        891      891              
============================================
- Hits          13910    13897      -13     
+ Misses         1001      994       -7     
  Partials        305      305              

codecov[bot] avatar Jan 04 '22 14:01 codecov[bot]