Crates.io | dddk_core |
lib.rs | dddk_core |
version | 0.6.0 |
source | src |
created_at | 2022-01-22 13:14:18.996957 |
updated_at | 2024-02-21 22:22:43.192116 |
description | Tactical DDD framework based on command_bus, event_bus and query_bus. It offers annex feature such as authorization, logging ... |
homepage | https://github.com/jultabary/4dk-core |
repository | |
max_upload_size | |
id | 519146 |
size | 91,962 |
The core project implements the primary concept of this framework.
It implements the entites : Command
, Event
and Query
.
A Command
is an object which triggers a usecase of type CommandHandler
. It is an order sent to the system. The transaction will result a list of Event
.
A Command
is dispatched to the correct handler trough a CommandBus
.
A CommandBus
valids the following trait fn dispatch(command: &Command) -> Vec<Box<dyn Event>>
.
This project proposes the following commandbus:
CommandDispatcher
: its new
factory takes in entry a vector Vec<Arc<Box CommandHandlerInBus>>
of CommandHandlerInBus
. This bus dispatches Command
to correct CommandHandler
.
You can find in samples different bus composition.
An Event
is an object returned by a CommandHandler
. An Event
is a result of a business transaction. It could trigger usecases of type EventHandler
An Event
is dispatched to its associates handlers through an EventBus
.
A Query
is an object which triggers a usecase of type QueryHandler
. It is a question asked to the system. A Response
is returned from a QueryHandler
.
An EventBus
valids the following trait fn dispatch(query: &Query) -> Vec<Box<dyn Response>>
.
This project proposes the following querybus:
QueryDispatcher
: its new
factory takes in entry a vector Vec<Arc<Box QueryHandlerInBus>>
of QueryHandlerInBus
. This bus dispatches Query
to its correct QueryHandler
.