mhinze / ShortBus

In-process mediator with low-friction API
MIT License
210 stars 41 forks source link

Why support multiple handlers for the same command? #6

Closed luizdamim closed 10 years ago

luizdamim commented 10 years ago

All I read about CQRS says that it's bad practice to have multiple handlers for the same command, it should be 1:1 relationship.

As Mediator.Send supports multiple handlers, how can I interpret the above statement?

  1. it's really bad practice, so Mediator.Send should be updated to call only one handler; or
  2. it's ok to have multiple handlers, it's just not so common (ShortBus is covering most specifics use cases)

BTW thank you for ShortBus, it's simple and brilliant! :)

mhinze commented 10 years ago

The good news is that this implementation is so simple you can use it as an example for your own. I am glad you like it.

You are free to enforce this constraint in your system, but I don't see a compelling reason to support it in ShortBus. On the other hand, I never really considered it, so if you'd like to submit a PR we can check it out. ShortBus isn't really about CQRS, it's more an application architecture thing.