what is the best practice when implementing DDD following akka-persistence-eventsourcing

99 views
Skip to first unread message

Avi

unread,
Jun 23, 2015, 11:44:00 AM6/23/15
to akka...@googlegroups.com
Hi 
I saw this example at typesafe activator akka-persistence-eventsourcing and it is really awesome ,but I have just a small question. 
in the project demonstrated we have the VehicleAggregate and the userAggregate which are completely separated , but what if we had another aggregate, i.e DriverAggregate (the driver that handle the vehicle) which can accept command like : 
case class PaintYourCar(color:String) extends Command 
and should send command to the VehicleAggregate with the ChangeColor command .

what is the best practice to do that ? 

should the DriverAggregate have a reference in it's constructor to the VehicleAggregate actorRef ? which means that the DriverAggregateManager should have something like 
{
...
val vehicleAggregateRef = VehicleAggregateManager.create(id)
  override def aggregateProps(id: String) = DriverAggregate.props(id, vehicleAggregateRef)
...
}
but it doesn't feel very good .
Please advise

Avi

Vaughn Vernon

unread,
Jun 23, 2015, 3:29:53 PM6/23/15
to akka...@googlegroups.com
Hello Avi,

I find several things in your example questionable, and basically not well modeled. You seem to be taking for of a technical approach to your model and probably not having conversations with domain experts. Does your domain expert really refer to VehicleAggregate, UserAggregate, and DriverAggregate. That's very unlikely. Would your domain expert really discuss telling a Driver to paint their car? Wouldn't it be the owner of that car who would tell a paint shop to paint their car some color?

I imagine that this is not a real domain model that you are working in because it seems either very contrived or at best completely technical in nature (not run by the business).

Best,
Vaughn

Avi Levi

unread,
Jun 23, 2015, 5:00:34 PM6/23/15
to akka...@googlegroups.com

Thank you very much Vaughn. Well of course you are correct . I was just trying to extend the example that I saw at typesafe activator . but if I understood you correctly we shouldn't have a reference of an aggregate within other aggregate, correct ?
Many thanks

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/Q9UGygYZjd8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Juan José Vázquez Delgado

unread,
Jun 24, 2015, 9:07:00 AM6/24/15
to akka...@googlegroups.com
Hi Avi, 

I've found this project [1] particularly useful in order to implement your DDD modeling with the use of Akka. Kudos for Paweł Kaczor. In our implementation, we've changed some backends, as Kafka and Cassandra instead of Event Store, and built some others building blocks, but this project was a source of inspiration for us in the beginnig of our Akka/DDD/CQRS/ES journey.

BR, 

Juanjo  

Avi Levi

unread,
Jun 24, 2015, 9:11:01 AM6/24/15
to akka...@googlegroups.com
Thanks you Juanjo!
Reply all
Reply to author
Forward
0 new messages