class QueueRoutes

Traits

Properties

protected array<class-string, array{null|string, null|string}|string> $routes

The mapping of class names to their default routes.

protected array<array-key, array{null|string, null|string}> $forwards

The queues that have been forwarded to another queue and/or connection.

Methods

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.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

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.

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
getConnection(object $queueable, UnitEnum|string|null $queue = null)

Get the queue connection that a given queueable instance should be routed to.

string|null
forwardedConnection(UnitEnum|string|null $queue)

Get the connection the given queue has been forwarded to.

string|null
getQueue(object $queueable)

Get the queue that a given queueable instance should be routed to.

string
forwardedQueue(string $queue, string|null $connection = null)

Get the queue the given queue has been forwarded to.

string
forwardedQueueForConnection(string $queue, string|null $connection)

Apply only forwards explicitly scoped to the given connection.

array|string|null
getRoute(object $queueable)

Get the route for a given queueable instance.

void
set(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the queue route for the given class.

void
forward(UnitEnum|array|string $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Register a forward for the given queue.

array
all()

Get all registered queue routes.

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.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

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.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

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.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

at line 36
string|null getConnection(object $queueable, UnitEnum|string|null $queue = null)

Get the queue connection that a given queueable instance should be routed to.

Parameters

object $queueable
UnitEnum|string|null $queue

the caller-selected queue, overriding the queueable's queue when resolving a forwarded connection

Return Value

string|null

at line 57
protected string|null forwardedConnection(UnitEnum|string|null $queue)

Get the connection the given queue has been forwarded to.

Parameters

UnitEnum|string|null $queue

Return Value

string|null

at line 69
string|null getQueue(object $queueable)

Get the queue that a given queueable instance should be routed to.

Parameters

object $queueable

Return Value

string|null

at line 85
string forwardedQueue(string $queue, string|null $connection = null)

Get the queue the given queue has been forwarded to.

Parameters

string $queue
string|null $connection

Return Value

string

at line 101
string forwardedQueueForConnection(string $queue, string|null $connection)

Apply only forwards explicitly scoped to the given connection.

Parameters

string $queue
string|null $connection

Return Value

string

at line 113
array|string|null getRoute(object $queueable)

Get the route for a given queueable instance.

Parameters

object $queueable

Return Value

array|string|null

at line 143
void set(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the queue route for the given class.

Boot-only. The route persists on the singleton registry for the worker lifetime and affects every subsequent dispatch of that class.

Parameters

array|string $class
UnitEnum|string|null $queue
UnitEnum|string|null $connection

Return Value

void

at line 165
void forward(UnitEnum|array|string $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Register a forward for the given queue.

Boot-only. Forwards persist on the singleton registry for the worker lifetime and affect every subsequent dispatch and queue operation.

Parameters

UnitEnum|array|string $queue
UnitEnum|string|null $to
UnitEnum|string|null $connection

Return Value

void

at line 182
array all()

Get all registered queue routes.

Return Value

array