A common case I have come along is a saga that sends multiple commands to different aggregate instances of the same aggregate and collects the events to end the workflow in a single step. To associate the saga to the multiple events I created a special field “traceId” in the events. But this is essentially the same as the “traceId” in the metadata of the events. Is there a way to use the metadata to correlate the events or is it necessary to create a duplicate property for this?
Another way I saw is to use SagaLifecycle.associateWith() to associate the Saga with each single aggregateId the saga sent a command for. Does this perform even for hundrets of such associations?
What is the better way to correlate such events? Is there another way to do this?