Eloquent
Ecotone comes with out of the box integration with Eloquent for State-Stored Aggregates. If you've installed Laravel, then you may start using Eloquent based Aggregates.
Your Models as Aggregates
Mark your Models with Aggregate attribute and set up Command Handlers.
Calling factory method "issue.report":
Calling action method "issue.close":
Aggregates require state to be always valid. If we have auto-generated identifiers from database, then in order to be assured that returned
Issue
has id, we need to callsave
. If you generate identifiers outside of the database, this step is not needed.Event publishing - if we have imported trait
WithEvents
, then we can publish events from the Aggregate using recordThat method.
In case of Ecotone you may use routing for your Message Handlers or direct Message Classes. It's up to you to decide whatever works best in your context.
Demo
Read more about integration in following blog post.
Last updated