CQRS - Single Command Handler?

I'm just trying to wrap my head around CQRS (/ ES). I have not done anything serious with CQRS. I guess now I just missed something very important. I am currently reading "Learning CQRS and Event Sourcing". There is one sentence that somehow puzzles me regarding the teams:

"One recipient is processing a command."

I also saw this in the CQRS sample application from Greg Young ( FakeBus.cs ), where an exception occurs when more than one command handler is registered for any type of command.

For me, this indicates that this is a fundamental principle for CQRS (or teams?). What is the reason? For me, this is somewhat contrary to intuition.

Imagine that I have two components that need to perform an action in response to a command (it does not matter if I have two instances of the same component or two independent components). Then I will need to create a handler that delegates the command to these components.

In my opinion, this introduces an unnecessary dependency. From the point of view of CQRS, a command is nothing more than a message that is sent. I do not understand why there should be only one handler for this message.

Can someone tell me what I am missing here? There is probably a very good reason for this, which I do not see now.

Hi

+3
source share
2 answers

I am by no means an expert with CQRS, but perhaps I can help shed some light.

" ". ?

. ( ) , . , ( ) . , , .

, .

+9

, , - ( , ). , .

.

. , , - . , .

: PurchaseGift. Purchase , GiftPurchased. GiftPurchase, , , - .

+2

All Articles