I have a service that handles a command CmdA { id = “100” , …}. This turns into a command invoked on an aggregate that produces two events EvA and EvB - not a frequent use case, but still can happen.
To ensure idempotency, I generate a deterministic id based on command’s id (“100”), for ex “abcd” and use it as EventId for those two events.
Now I have two events tagged with the same id. However, these events (being enriched and transformed into integration events) need to be reported to downstream systems and need unique id for each events.
I am inclined to generate unique ids for events and store them as part of event body. In this case, the EventStore’s event id is turned into a “commit id” that will be used for idempotence purposes only.
Is there a better way to tackle the above task?