RECQ Components Design
Define your micorservices architecture structure.
Last updated
Define your micorservices architecture structure.
Last updated
Now that you have defined all the Messages you need to identify the components handling those messages.
We need to choose between:
Aggregate
Projector
Projection
Invoker
Service
Saga
Observer
Let's start from the Domain logic handling aspects of the application, we have previously individuated the TodoList domain composed of the TodoList, Todo and User entities.
The component and also the pattern used to manage Domain Change Request is Aggregate which collect a group of entities in a Tree Relational Structure with a root representing the Consistency Constraint Boundaries and branches or leaves representing functional depending entities. A TodoListAggregate is needed to handle TodoListCreateCommands, TodoListDeleteCommand, TodoListAddTodoCommand, TodoListRemoveTodoCommand, TodoListCheckTodoCommand and produce the related events to communicate to the entire system that the state is changed.
Data changes must be materialized in some way, to create a database representing a practical and queryable system state we need to use a projector that handles Domain Events and writes changes inside a Repository. A TodoListProjector is needed to handle TodoListCreatedEvents, TodoListDeleteEvents, TodoListTodoAddedEvent, TodoListTosoRemovedEvent, TodoListTodoCheckedEvent and materialize the changes.
Then we need to access the system state and make queries to receive views, so we require a TodoListProjection to handle TodoListListItemViewFindAllQueries returning a collection of TodoListListItemView and TodoListViewFindByIdentifierQueries returning a TodoListView.
In the end, we need a way to forge Commands and Queries accessible from the outside of a RECQ Architecture. To do this we need an invoker that exposes all the functions and implements logic (the Service Layer of the Layered Architecture). So we are gonna to define a TodoListInvoker generating payloads for every single TodoList-related command and query.
In this tutorial we do not need to handle cross-domain logic or do particular behaviour extensions, we will dedicate a specific tutorial to handle complex scenarios in RECQ Architectures. Extend TodoList - Handle Complexity Tutorial