Events
Learn about domain events that can occur in a domain.
When something occurs in a bounded context, other bounded contexts may want to know about that action. Perhaps they would like to do some process such as executing another action, or they would only like to save some information. To propagate executions that have happened in a bounded context is important to count on events.
What are events?
An event is something that has happened in the past. They usually cause a reaction elsewhere. It is important to clarify that events are different from each other. It means that although two events have been created based on the same information, they are completely different. In other words, events cannot be duplicated and cannot be modified.
Events are immutable
When something has happened in the real world, it is impossible for us to change that action. That is part of the past. Thinking about this demeanor of the real world is a good insight to model behavior in a software application. Due to mirroring such behavior in the application, it is possible to save everything that has happened. As per real-world, nothing can be modified and these events can produce some reaction elsewhere.
What are domain events?
Domain events are the second of the three activities that can occur in a domain. Due to being something that has happened in the past, domain events are immutable. Domain events describe action or events that occur in the domain. They are important to domain experts. Therefore they are built based on the ubiquitous language. A domain event can be represented by using any notation useful to achieve it. Such a notation can be JSON or YAML. Let us assume a customer of a bank wants to transfer money. Once the command is sent and the bank’s system processes it, a domain event is produced and saved in the system.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy