Aggregate id on the event changes after firing it?

Note the first screenshot shows a debugger with an aggregateId of prima.mock.ServiceMenuItem.2e2369cd-95a5-4c34-8a07-b20fc2999be8 but when I observe it in domain_event_entry table the id has changed to 10e6232f-059d-4080-aaf6-16f389fb9dad

I don’t understand why this happens

Screen Shot 2018-11-15 at 4.52.02 PM.png

Forgot to attach the screenshot from the event store database

Screen Shot 2018-11-15 at 4.52.23 PM.png

Hi Michael,

I see you’re calling the EventBus#publish(Object) function yourself.
From an Axon perspective, you’re then not publishing an event from a domain object, but from a regular component.
Due to that, Axon regards it as an EventMessage instead of a DomainEventMessage.
As it stands, only DomainEventMessages set the aggregateIdentifier column as the actual Aggregate identifier.

When it’s a regular EventMessage, the aggregateIdentifier is the same value as the eventIdentifier.
You could thus verify if what I am stating there is true, which thus points out why the aggregate identifier isn’t as you’ve expected it.
If you want to store Domain Event Messages, the event should be published from the lifecycle of an Aggregate.
To do that, you should be in the scope of an Aggregate and use the AggregateLifecycle#apply(Object...) function.

Hope this helps you out Michael!