Spawning aggregates (Axon 3.3)

Hi,

I have some questions regarding the spawning of aggregates in Axon 3.3:

  • In which case do I use this feature instead of the regular saga handling? (As I saw everytime an aggregate lifecycle is bound to another aggregate. Or is there more to consider?)
  • What exceptions can occur and what is the preferred way to handle it? (Your example does not seem to be production ready here…)
  • How is the transaction in this case? It seems that the aggregates share the same transaction?
  • How is the case handled if the second aggregate could already exist? (Project the second aggregate? (This could fail anyway because it could be created in the mean time.) Or just catch the Exception Axon throws when it was already created? Or send an event in customer that this this order is created for this customer?) (corresponds to question 2)

I more advanced scenario is: I have an customer aggregate like in the example but I have an aggregate that accumulates the orders monthly and sends a monthly bill to them. Let’s say its the Bill aggregate. The bill that I want to add the order to can be already existing or not. Now I can spawn it from the customer.
But could I send an additional command to the other aggregate in the case the bill already exists and I want to append the order to it?

I think this could be of general interest and added it to the documentation issue https://github.com/AxonFramework/ReferenceGuide/issues/38

Regards

Marc

Hi Marc,

I have just answered your question on the ref-guide issue.

Cheers,
Milan.