Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mathias Noback:
Collecting events and the event dispatching command bus
Jan 13, 2015 @ 17:52:33

Mathias Noback has posted the next part of his command bus in PHP series today with a few suggestions about event handling and when it's a good idea to dispatch them.

It was quite a ride so far. We have seen commands, command buses, events and event buses. We distilled some more knowledge about them while formulating answers to some interesting questions from readers.

In this new post, his focus is on collecting the events that happen as a part of the command's execution. He uses his "UserSignedUp" event his his previous example and a "send welcome email" handler to show why it may not be the best idea to execute all events simultaneously. Instead, he recommends making use of event collections (a feature his SimpleBus library supports) to define "providers" that can collect the events that need to happen and delegate the execution of them one after the other. Example code is included all through the post of events, providers and commands that make use of this idea.

tagged: commandbus command collect event provider dispatch tutorial

Link: http://php-and-symfony.matthiasnoback.nl/2015/01/collecting-events-and-the-events-aware-command-bus/


Trending Topics: