LockingMiddleware
in package
implements
Middleware
If another command is already being executed, locks the command bus and queues the new incoming commands until the first has completed.
Interfaces, Classes and Traits
- Middleware
- Middleware are the plugins of Tactician. They receive each command that's given to the CommandBus and can take any action they choose. Middleware can continue the Command processing by passing the command they receive to the $next callable, which is essentially the "next" Middleware in the chain.
Table of Contents
- $isExecuting : bool
- $queue : array<string|int, callable>
- execute() : mixed|void
- Execute the given command... after other running commands are complete.
- executeQueuedJobs() : mixed
- Process any pending commands in the queue. If multiple, jobs are in the queue, only the first return value is given back.
Properties
$isExecuting
private
bool
$isExecuting
$queue
private
array<string|int, callable>
$queue
= []
Methods
execute()
Execute the given command... after other running commands are complete.
public
execute(object $command, callable $next) : mixed|void
Parameters
- $command : object
- $next : callable
Tags
Return values
mixed|void —executeQueuedJobs()
Process any pending commands in the queue. If multiple, jobs are in the queue, only the first return value is given back.
protected
executeQueuedJobs() : mixed