Elffuss BraidHub

kikocis/EDC public

main · 985 BRenderedRawPermalink
1# Synchronous Commands
2
3## Decision
4
5We're making all the Command interactions with the mutable entities (`ContractNegotiation` and `TransferProcess`) synchronous.
6
7## Rationale
8
9Asynchronous commands brought in a lot of unuseful complexity, they brought also downsides as:
10- commands would need to be persisted for reliability
11- their result is currently "lost" so there would be the need for some sort of notification mechanism.
12
13Make them synchronous will make everything simpler, it would make them align with the current implementation of the
14"protocol" services, that are updating the status synchronously on incoming protocol messages.
15
16## Approach
17
18The `CommandHandler` will return a `CommandResult` that will be successful when the command executed correctly, otherwise
19will be a failure.
20
21To avoid conflicts with the state machines, every command handler will need to lease the entity before applying the state
22change. If the lease cannot be obtained, the command will fail.