thenativeweb / wolkenkit

wolkenkit is an open-source CQRS and event-sourcing framework based on Node.js, and it supports JavaScript and TypeScript.
https://www.thenativeweb.io/wolkenkit/framework
GNU Affero General Public License v3.0
1.09k stars 52 forks source link

Configure command strategy as at-least-once or at-most-once #177

Open goloroden opened 5 years ago

goloroden commented 5 years ago

What is this feature about?

Since commands can fail, it could make sense to let the application developer configure whether a command should be handled as at-least-once or as at-most-once. It may also make sense to let the developer define how many retries should be done, if needed. This should be done via a function, such as:

retryOnError (err, retryCount) {
  return true; // or whatever makes sense here
}

What needs to be done to implement this feature?

goloroden commented 4 years ago

There is a first implementation, see https://github.com/thenativeweb/wolkenkit/pull/826 … however, we are not sure how useful it actually is, so we need to think about whether we are actually going to merge this…

goloroden commented 4 years ago

We have decided to defer this one, as a reliable and reasonable implementation will require to adjust the queue, so that the queue can decide whether and if so, how often, to re-send a command. It does not make too much sense to have this partially implemented in the domain server, if you need to adjust the queue anyway – so a retry mechanism with a counter at the queue sounds better. For now, we have decided to delay this.