aggregateIdentifier

Hi,

I am using axon server to store my events. For my event store aggregateIdentifier, I am using uuid. I am receiving commands from some another application.

That application doesn’t know about my aggregateIdentifier, then how I know that which aggregateIdentifier to update?

For Example

ABC application is raising command for a customer. First time he sends createCustomerCommand second time changeCurrentAddress.

how my event store knows that, update event is for a particular customer.

Thanks,

Vikas

Hey Vikas,

When command enters the aggregate in your application it knows the aggregate id @TargetAggregateIdentifier.

When you raise an event from that Aggregate, in the event metadata the aggregate identifier is stored.

Therefore any application that is going to handle event will know what aggregate emited it.

Therefore separate applications that are supposed to do some command dispatching for specific aggregate can get identifiers from events themselves.

Such correlation is used in @Saga, you handle UserCreatedEvent and then you can dispatch ChangeCurrentAddress for aggregate which you identify based on the UserCreatedEvent payload.