event-driven-io / emmett

Emmett - a Node.js library taking your event-driven applications back to the future!
https://event-driven-io.github.io/emmett/
195 stars 19 forks source link

Command handling idempotency improvements #119

Closed oskardudycz closed 1 month ago

oskardudycz commented 1 month ago
  1. Added built-in retries to handle concurrency issues, for instance retrying on the stream version conflict.

  2. [BREAKING]: Changed the stream read and aggregation behaviour to always return the result and never null together with a flag if the stream exists.

Now:

Both will return the default stream position when the stream doesn't exist (for the event store, that will be -1, 0 for others).

  1. [BREAKING]: Made Command handler signature take options object instead of an array of parameters.** This is needed to extend the command handler in the future and even now with common retry options.

Now, instead of:

const handle = CommandHandler(evolve, initialState);

you need to do:

const handle = CommandHandler({ evolve, initialState });