-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding command bus and separate out command handling from domain. I opted for <a href="https://github.com/SimpleBus" target="_blank">SimpleBus</a> because I liked the simplicity and have a lot of respect for it's maintainer Mathias. I did have <a href="SimpleBus/CommandBus#2" target="_blank">some misgivings over the use of a type hint for commands</a>, but generally it suited what I needed to do well, it also forced me to create an explicit CommandHandling layer, which I think works quite well. It's been completely changed in version 2 now anyway, and is <a href="https://github.com/SimpleBus/MessageBus" target="_blank">more of a generic 'MessageBus' now</a>. There are quite a few command buses that have popped up recently, I created <a href="https://github.com/jenkoian/CommandBusCommandBus" target="_blank">CommandBusCommandBus</a> as a case in point. Anyway the point is I wanted to introduce a command bus to make my example complete. Here you can see how I've moved all the command handling bits to the CommandHandling later I spoke about above. It just means that rather than passing command to handlers directly, I can just 'throw' them on to the command bus now. This has the advantages of being able to decorate the command bus to be able to perform additional tasks against commands should I want to; I can make the command bus handle commands asynchronously should I choose; plus other niceities that arise when delegating message handling in this way.
- Loading branch information
Showing
16 changed files
with
406 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.