I don’t see any implementation of this concept in the demo project (AxonBank, GiftCard, AxonHotel). As I see, if communication between aggregate is needed then Saga is the solution. The main difference thing that I see is that Saga can store state while domain service is just a stateless object. So why is domain service not being use or implement. Also I found this article [Isn’t Saga - just a leaked domain logic] (https://groups.google.com/g/dddcqrs/c/_c7rxQUrZTE). I totally agree with him that we would leak some domain logic into saga. Or should we treat saga as part of the domain model ?
As a Domain Service is nothing more than some service you’d invoke, there’s not that much of an abstraction the Framework can build around it.
As such, this is left to the user.
From within the Aggregate, for example, you can easily tie in some (Spring) component in your command handling function to perform some validation that might otherwise obstruct the Aggregate’s code.
So, long story short, Axon Framework does not have any out-of-the-box domain service, as there’s no generic solution to provide.
And here’s another to your second question.
In the future, it’s better to construct another question instead.
I totally agree with him that we would leak some domain logic into saga. Or should we treat saga as part of the domain model ?
This argument depends on the goal of the Saga and how it plays with the API, if you ask me.
If the Saga delegates operations between Domain Models within the same Bounded Context, then those concepts should be sharable.
Hence, I wouldn’t talk about leaking in this case.
If the Saga delegates operations between different Contexts, you’d be careful with what you exactly share.
If you’re conscious about what you share, are you still “leaking domain logic?”
To me, it sounds like there’s intent in that case to share the bare minimum that you’re willing to share.
So what it comes down to is how the API is defined.
If the API is such that it requires (duplicating) domain logic, then I’d agree with the post you share.
But, if the API is designed well enough, I wouldn’t be to concerned about this.