The example above, don’t work
The ACreatedEvent in the microservice B is never called
Do you have an idea knowing that each microservice must have a reference with the other ?
Maybe what you can do is perform an @EventHandler (not @EventSourcingHandler) and then fire a command based on the desired event. If synchronicity is a concern I would not recommend this approach
Handling the event source directly on BAggregate will not work since they are distinct aggregates.
No. The other question, is to link two Aggregate in the same Microservice
Now, i would like create two aggregates ( in different microservices) and exchange the aggregate id
It’s possible to send two http request, but I thought it’s more attractive using the eventBus when the first aggregate is created
The Aggregate provided by Axon Framework is for a Command Model. The aggregate is essentially a component, to begin with. You can read more about it here.
In an event sourcing model, the @EventSourcingHandler in the aggregate handles the events originating from it. In your use case, add the @EventHandler annotation in a @Component but not an @Aggregate.