class RoutingQueue implements Queue

Wraps the queue connection so jobs are routed onto their registered queue when they are pushed.

Laravel's native queue routing ({\Illuminate\Queue\QueueRoutes}) is only applied by the bus dispatcher (`dispatch()`); the low-level `push()` — which most of Flarum and its extensions use — bypasses it. This wrapper closes that gap: when a job is pushed with no explicit queue, its class is looked up in the route map (which resolves through the class hierarchy: parents, interfaces, traits) and the resulting queue is applied. An explicit queue always wins; an unrouted job falls through to the driver default. It wraps whatever connection is bound to `flarum.queue.connection` (core's or a replacement from FoF Redis / Horizon), so routing is driver-independent. Everything other than the routing decision is delegated to the wrapped connection, including methods beyond the Queue contract (via `__call`); the underlying driver is available through {\Flarum\Queue\getDriver()} for the few callers that need the concrete instance.

Methods

__construct(Queue $driver, QueueRoutes $routes)

No description

Queue
getDriver()

The wrapped driver connection.

string|null
routeFor(mixed $job, string|null $queue)

Resolve the queue for a job: an explicit queue wins; otherwise the route registered for the job's class (or an ancestor); otherwise null (driver default). Only job objects can be routed — string job names pass through.

push($job, $data = '', $queue = null)

No description

later($delay, $job, $data = '', $queue = null)

No description

bulk($jobs, $data = '', $queue = null)

No description

pushOn($queue, $job, $data = '')

No description

laterOn($queue, $delay, $job, $data = '')

No description

pushRaw($payload, $queue = null, array $options = [])

No description

pop($queue = null)

No description

size($queue = null)

No description

pendingSize($queue = null)

No description

delayedSize($queue = null)

No description

reservedSize($queue = null)

No description

creationTimeOfOldestPendingJob($queue = null)

No description

getConnectionName()

No description

setConnectionName($name)

No description

mixed
__call(string $name, array<int,mixed> $arguments)

Delegate any method beyond the Queue contract to the wrapped driver (drivers expose extra methods — setContainer(), getConnectionConfig(), etc. — that callers rely on).

Details

__construct(Queue $driver, QueueRoutes $routes)

Parameters

Queue $driver
QueueRoutes $routes

Queue getDriver()

The wrapped driver connection.

Return Value

Queue

protected string|null routeFor(mixed $job, string|null $queue)

Resolve the queue for a job: an explicit queue wins; otherwise the route registered for the job's class (or an ancestor); otherwise null (driver default). Only job objects can be routed — string job names pass through.

Parameters

mixed $job
string|null $queue

Return Value

string|null

push($job, $data = '', $queue = null)

Parameters

$job
$data
$queue

later($delay, $job, $data = '', $queue = null)

Parameters

$delay
$job
$data
$queue

bulk($jobs, $data = '', $queue = null)

Parameters

$jobs
$data
$queue

pushOn($queue, $job, $data = '')

Parameters

$queue
$job
$data

laterOn($queue, $delay, $job, $data = '')

Parameters

$queue
$delay
$job
$data

pushRaw($payload, $queue = null, array $options = [])

Parameters

$payload
$queue
array $options

pop($queue = null)

Parameters

$queue

size($queue = null)

Parameters

$queue

pendingSize($queue = null)

Parameters

$queue

delayedSize($queue = null)

Parameters

$queue

reservedSize($queue = null)

Parameters

$queue

creationTimeOfOldestPendingJob($queue = null)

Parameters

$queue

getConnectionName()

setConnectionName($name)

Parameters

$name

mixed __call(string $name, array<int,mixed> $arguments)

Delegate any method beyond the Queue contract to the wrapped driver (drivers expose extra methods — setContainer(), getConnectionConfig(), etc. — that callers rely on).

Parameters

string $name
array<int,mixed> $arguments

Return Value

mixed