Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1368

Aggregate root communication patterns

$
0
0

My question is regarding communication between aggregate roots in event sourcing using Akka persistent actors. Specifically, if I want an aggregate root to respond to an event that happened in another aggregate root, how do I do that?

Using the shopping cart example: Implementing Microservices with Akka :: Akka Platform Guide, we can take the example that the Item aggregate needs to know when a cart has been checked out to update its count in the warehouse. What’s the most idiomatic way to do this? I can think of two options

  1. Have the Item actor representing the AR also understand the ShoppingCart.Event type (Behavior[Item.Command with ShoppingCart.Event]) and have it subscribe to a stream of events from the shopping cart service, or
  2. Have a a coordinator actor subscribe to a stream of events (requiring the producing aggregates to produce to it) and send commands to the correct aggregate roots

7 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1368

Trending Articles