QueueManager
class QueueManager implements Factory, Monitor mixin Queue (View source)
Traits
Properties
| protected Application | $app | The application instance. |
|
| protected array | $connections | The array of resolved queue connections. |
|
| protected array | $connectors | The array of resolved queue connectors. |
Methods
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Resolve the default connection name for a given queueable instance.
Resolve the default queue name for a given queueable instance.
Register an event listener for the before job event.
Register an event listener for the after job event.
Register an event listener for the exception occurred job event.
Register an event listener for the daemon queue loop.
Register an event listener for the failed job event.
Register an event listener for the daemon queue starting.
Register an event listener for the daemon queue stopping.
Register a callback to be invoked when a job runs for longer than a given amount of time.
Set the queue route for the given class.
Forward the given queue to another queue and/or connection.
Determine if the driver is connected.
Resolve a queue connection instance.
Get the connector for a given driver.
Pause a queue by its name and connection.
Pause a queue by its name and connection for a given amount of time.
Pause job processing for all queues on all connections.
Resume a paused queue by its connection and name.
Resume job processing for all queues on all connections.
Determine if a queue is paused.
Determine which of the given queues are currently paused.
Indicate that queue workers should not poll for restart or pause signals.
Get the queue connection configuration.
Get the name of the default queue connection.
Set the name of the default queue connection.
Get the full name for the given connection.
Get the application instance used by the manager.
Register a callback to be executed when creating job payloads.
Dynamically pass calls to the default connection.
Details
protected int
secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int
availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int
parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int
currentTime()
Get the current system time as a UNIX timestamp.
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
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(Application $app)
Create a new queue manager instance.
void
before(mixed $callback)
Register an event listener for the before job event.
void
after(mixed $callback)
Register an event listener for the after job event.
void
exceptionOccurred(mixed $callback)
Register an event listener for the exception occurred job event.
void
looping(mixed $callback)
Register an event listener for the daemon queue loop.
void
failing(mixed $callback)
Register an event listener for the failed job event.
void
starting(mixed $callback)
Register an event listener for the daemon queue starting.
void
stopping(mixed $callback)
Register an event listener for the daemon queue stopping.
void
whenJobRunsLongerThan(DateTimeInterface|CarbonInterval|float|int $threshold, callable $handler)
Register a callback to be invoked when a job runs for longer than a given amount of time.
void
route(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)
Set the queue route for the given class.
void
forward(array|string|UnitEnum $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)
Forward the given queue to another queue and/or connection.
bool
connected(UnitEnum|string|null $name = null)
Determine if the driver is connected.
Queue
connection(UnitEnum|string|null $name = null)
Resolve a queue connection instance.
protected Queue
resolve(string $name)
Resolve a queue connection.
protected ConnectorInterface
getConnector(string $driver)
Get the connector for a given driver.
void
pause(UnitEnum|string $queue, UnitEnum|string|null $connection = null)
Pause a queue by its name and connection.
void
pauseFor(UnitEnum|string $queue, DateTimeInterface|DateInterval|int $ttl, UnitEnum|string|null $connection = null)
Pause a queue by its name and connection for a given amount of time.
void
pauseAll()
Pause job processing for all queues on all connections.
void
resume(UnitEnum|string $queue, UnitEnum|string|null $connection = null)
Resume a paused queue by its connection and name.
void
resumeAll()
Resume job processing for all queues on all connections.
Queues paused individually are not affected.
bool
isPaused(UnitEnum|string $queue, UnitEnum|string|null $connection = null)
Determine if a queue is paused.
array
getPausedQueues(array $queues, string|null $connection = null)
Determine which of the given queues are currently paused.
void
withoutInterruptionPolling()
Indicate that queue workers should not poll for restart or pause signals.
This prevents the workers from hitting the application cache to determine if they need to pause or restart.
void
extend(string $driver, Closure $resolver)
Add a queue connection resolver.
void
addConnector(string $driver, Closure $resolver)
Add a queue connection resolver.
protected array|null
getConfig(string $name)
Get the queue connection configuration.
string
getDefaultDriver()
Get the name of the default queue connection.
void
setDefaultDriver(UnitEnum|string $name)
Set the name of the default queue connection.
string
getName(string|null $connection = null)
Get the full name for the given connection.
Application
getApplication()
Get the application instance used by the manager.
$this
setApplication(Application $app)
Set the application instance used by the manager.
void
createPayloadUsing(callable|null $callback)
Register a callback to be executed when creating job payloads.
mixed
__call(string $method, array $parameters)
Dynamically pass calls to the default connection.