beberlei / litecqrs-php

Small convention based CQRS library for PHP
MIT License
553 stars 47 forks source link

Implement throwing of CommandFailedStackException in SequentialCommandBus. #30

Closed coderbyheart closed 11 years ago

beberlei commented 11 years ago

Subcommand exceptions should not be thrown imho. Say you have a command that triggers $N events, and several of those trigger new commands. If one command fails, then this is just the way it is, but everything else should not be stopped because of it. It will create very weird inconsistent states.

coderbyheart commented 11 years ago

How can I get notified of an exception in the command chain then?

coderbyheart commented 11 years ago

Ok. CQRS introduces eventual consistency. CQRS also means that you should assume that every command succeeds. To verify that a command worked, use a query. Failed commands should notify to user, though.

I've created PR #31 which clarifies the behaviour of SequentialCommandBus.

coderbyheart commented 11 years ago

How about we create a CommandFailed event, so exceptions would not be silently dropped?

henrikbjorn commented 11 years ago

Just because you use the CommandBus dosent mean you also you the EventBus.