Open benjamindulau opened 10 years ago
It shifts off a command at a time, and if a command is added to the stack while invoking another command it will be on the stack for the next array_shift called which you can see here https://github.com/beberlei/litecqrs-php/blob/master/src/LiteCQRS/Commanding/SequentialCommandBus.php#L49
@henrikbjorn Yeah I saw that. My point is that if you have a long process running impacting several commands being dispatched, the next commands will never be handled.
If in 1 single process (request), you do the following:
Command1 > Handling > Event > EventHandler > Command2
Command2 is never handled because Command1 is still running from the CommandBus point of view: https://github.com/beberlei/litecqrs-php/blob/master/src/LiteCQRS/Commanding/SequentialCommandBus.php#L43
Hey,
I'm taking a look at the SequentialCommandBus and I don't understand how it can work if a command is added to stack during the execution context of another command in a synchronous system.
Let's say I want to implement some sort of a ProcessManager. This process manager would listen to some domain events and will send new commands to the CommandBus.
This entire process is initiated by a first command execution. Given than the command bus blocks the execution until a command handling has ended, the underlaying commands (send synchronously) won't be executed. They will stack in the command bus and will be lost when the request dies.
Where is the DirectCommandBus introduced in this example: https://github.com/beberlei/litecqrs-php/blob/master/example/example3_sequential_commands.php ?
Cheers