proteanhq/protean

Serialize/Deserialize Aggregate objects sent through Domain Events

Closed this issue · 1 comments

Evaluate if it's correct for Domain events to carry full-blown data of aggregate over the wire. A Subscriber can always query the data source again and fetch the aggregate in a typical system, but if we want to use disconnected microservices, it might be better to send the entire data packet over the wire.

If the domain event needs to carry substantial data over the wire, it can do so. But the data needs to be specified explicitly as part of the domain event structure, and not derived automatically from the aggregate structure.

It is also a valid pattern to publish the aggregate's reference identifier over the wire and expose an API to collect further data, but it is strongly advised not to use APIs across microservices.