Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • System Architecture

Generating Past Transitions

Written by Oleksandr Sydorenko

Updated at May 5th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • System Architecture
+ More

This approach entails generating an approximate stream of events for each aggregate so that the stream of events can be projected into the same state representation as in the original implementation. Consider the example you saw in Chapter 7, as repre‐ sented in Table 11-1.

Table 11-1. A state-based representation of the aggregate’s data

lead- in

first- last- phone_numbe name name

r status last- contacted-on

order-placed- on

converted-on

followup- on

12

Shauna Mercia 555-4753

converted 2020-05-27T

12:02:12.51Z

2020-05-27T

12:02:12.51Z

2020-05-27T

12:02:12.51Z

null

We can assume from the business logic perspective that the instance of the aggregate has been initialized; then the person has been contacted, an order has been placed, and finally, since the status was “converted,” the payment for the order has been con‐ firmed. The following set of events can represent all of these assumptions:

{

"lead-id": 12,

"event-id": 0,

"event-type": "lead-initialized",

"first-name": "Shauna",

"last-name": "Mercia",

"phone-number": "555-4753"

},

{

"lead-id": 12,

"event-id": 1,

"event-type": "contacted",

"timestamp": "2020-05-27T12:02:12.51Z"

},

{

"lead-id": 12,

"event-id": 2,

"event-type": "order-submitted",

"payment-deadline": "2020-05-30T12:02:12.51Z",

"timestamp": "2020-05-27T12:02:12.51Z"

},

{

"lead-id": 12,

"event-id": 3,

"event-type": "payment-confirmed",

"status": "converted",

"timestamp": "2020-05-27T12:38:44.12Z"

}

When applied one by one, these events can be projected into the exact state represen‐ tation as in the original system. The “recovered” events can be easily tested by projec‐ ting the state and comparing it to the original data.

However, it’s important to keep in mind the disadvantage of this approach. The goal of using event sourcing is to have a reliable, strongly consistent history of the aggre‐ gates’ domain events. When this approach is used, it’s impossible to recover the com‐ plete history of state transitions. In the preceding example, we don’t know how many times the sales agent has contacted the person, and therefore, how many “contacted” events we have missed.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Discovering Domain Knowledge
  • Business Problems
  • Knowledge Discovery
  • Communication
  • What Is a Ubiquitous Language?

info@smartphonekey.com

  • Home
  • How It Works
  • Features
  • Residents and Tenants
  • Property Managers
  • Airbnb Hosts
  • Products
  • Blog
  • Guide for Usage and Installation
  • Our Team
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Facebook
  • Instagram
  • LinkedIn
© 2025, Smartphonekey.com Powered by Shopify
Expand