commanded / recipes

Commanded recipes
12 stars 1 forks source link

[Recipe] Prevent duplicate commands #8

Open slashdotdash opened 4 years ago

slashdotdash commented 4 years ago

How to prevent duplicate commands from being executed by an aggregate.

Use a router middleware to record the identity of each successfully dispatched command and prevent duplicates. Record the causation_id for each event applied to an aggregate and reject commands that have already be seen (caused an event to be recorded).