Dispatcher
class Dispatcher implements QueueingDispatcher (View source)
Traits
Properties
| protected Container | $container | The container implementation. |
|
| protected Pipeline | $pipeline | The pipeline instance for the bus. |
|
| protected array | $pipes | The pipes to send commands through before dispatching. |
|
| protected array | $handlers | The command to handler mapping for non-self-handling events. |
|
| protected Closure|null | $queueResolver | The queue resolver callback. |
|
| protected bool | $allowsDispatchingAfterResponses | Indicates if dispatching after response is disabled. |
Methods
Get a configuration value from an attribute, falling back to a property.
Extract the value from an attribute instance.
Get an instance of the given attribute class from the target class or its parents.
Determine if a property declared on a child class overrides an inherited attribute.
Resolve the default connection name for a given queueable instance.
Resolve the default queue name for a given queueable instance.
Create a new command dispatcher instance.
Dispatch a command to its appropriate handler.
Dispatch a command to its appropriate handler in the current process.
Dispatch a command to its appropriate handler in the current process without using the synchronous queue.
Dispatch multiple commands in bulk to their appropriate handlers on the queue.
Determine if the given command has a handler.
Retrieve the handler for a command.
Determine if the given command should be queued.
Dispatch a command to its appropriate handler behind a queue.
Dispatch a command to its appropriate handler after the current process.
Set the pipes through which commands should be piped before dispatching.
Map a command to a handler.
Allow dispatching after responses.
Disable dispatching after responses.
Details
protected mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)
Get a configuration value from an attribute, falling back to a property.
protected mixed
extractAttributeValue(object $instance)
Extract the value from an attribute instance.
protected object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)
Get an instance of the given attribute class from the target class or its parents.
protected bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)
Determine if a property declared on a child class overrides an inherited attribute.
string|null
resolveConnectionFromQueueRoute(object $queueable)
Resolve the default connection name for a given queueable instance.
string|null
resolveQueueFromQueueRoute(object $queueable)
Resolve the default queue name for a given queueable instance.
protected QueueRoutes
queueRoutes()
Get the queue routes manager instance.
__construct(Container $container, Closure|null $queueResolver = null)
Create a new command dispatcher instance.
mixed
dispatch(mixed $command)
Dispatch a command to its appropriate handler.
mixed
dispatchSync(mixed $command, mixed $handler = null)
Dispatch a command to its appropriate handler in the current process.
Queueable jobs will be dispatched to the "sync" queue.
mixed
dispatchNow(mixed $command, mixed $handler = null)
Dispatch a command to its appropriate handler in the current process without using the synchronous queue.
void
bulk(iterable $jobs)
Dispatch multiple commands in bulk to their appropriate handlers on the queue.
Batch|null
findBatch(string $batchId)
Attempt to find the batch with the given ID.
PendingBatch
batch(Collection|array $jobs)
Create a new batch of queueable jobs.
mixed
chain(Collection|array|null $jobs = null)
Create a new chain of queueable jobs.
bool
hasCommandHandler(mixed $command)
Determine if the given command has a handler.
mixed
getCommandHandler(mixed $command)
Retrieve the handler for a command.
protected bool
commandShouldBeQueued(mixed $command)
Determine if the given command should be queued.
mixed
dispatchToQueue(mixed $command)
Dispatch a command to its appropriate handler behind a queue.
protected mixed
pushCommandToQueue(Queue $queue, mixed $command)
Push the command onto the given queue instance.
void
dispatchAfterResponse(mixed $command, mixed $handler = null)
Dispatch a command to its appropriate handler after the current process.
$this
pipeThrough(array $pipes)
Set the pipes through which commands should be piped before dispatching.
$this
map(array $map)
Map a command to a handler.
$this
withDispatchingAfterResponses()
Allow dispatching after responses.
$this
withoutDispatchingAfterResponses()
Disable dispatching after responses.