class CallQueuedHandler (View source)

Properties

protected Dispatcher $dispatcher

The bus dispatcher implementation.

protected Container $container

The container instance.

protected mixed $runningCommand

The command currently being processed.

Methods

__construct(Dispatcher $dispatcher, Container $container)

Create a new handler instance.

void
call(Job $job, array $data)

Handle the queued job.

mixed
getCommand(array $data)

Get the command from the given payload.

mixed
dispatchThroughMiddleware(Job $job, mixed $command)

Dispatch the given job / command through its specified middleware.

mixed
resolveHandler(Job $job, mixed $command)

Resolve the handler for the given command.

mixed
setJobInstanceIfNecessary(Job $job, mixed $instance)

Set the job instance of the given class if necessary.

void
ensureNextJobInChainIsDispatched(mixed $command)

Ensure the next job in the chain is dispatched if applicable.

void
ensureSuccessfulBatchJobIsRecorded(mixed $command)

Ensure the batch is notified of the successful job completion.

void
ensureUniqueJobLockIsReleased(mixed $command)

Ensure the lock for a unique job is released.

bool
commandShouldBeDebounced(mixed $command)

Determine if the debounced command was superseded by a newer dispatch.

void
deleteDebouncedJob(Job $job, mixed $command)

Handle a debounced (superseded) job by firing an event and deleting it.

bool
commandShouldBeUnique(mixed $command)

Determine if the given command should be unique.

bool
commandShouldBeUniqueUntilProcessing(mixed $command)

Determine if the given command should be unique until processing begins.

void
handleModelNotFound(Job $job, Throwable $e)

Handle a model not found exception.

void
ensureUniqueJobLockIsReleasedViaContext()

Ensure the lock for a unique job is released via context.

void
ensureSuccessfulBatchJobIsRecordedForMissingModel(Job $job, string $class)

Record a potentially batched job as successful when deleted because models were missing.

void
failed(array $data, Throwable|null $e, string $uuid, Job|null $job = null)

Call the failed method on the job instance.

void
ensureFailedBatchJobIsRecorded(string $uuid, mixed $command, Throwable $e)

Ensure the batch is notified of the failed job.

void
ensureChainCatchCallbacksAreInvoked(string $uuid, mixed $command, Throwable $e)

Ensure the chained job catch callbacks are invoked.

mixed
getRunningCommand()

Get the command currently being processed.

Details

__construct(Dispatcher $dispatcher, Container $container)

Create a new handler instance.

Parameters

Dispatcher $dispatcher
Container $container

void call(Job $job, array $data)

Handle the queued job.

Parameters

Job $job
array $data

Return Value

void

protected mixed getCommand(array $data)

Get the command from the given payload.

Parameters

array $data

Return Value

mixed

Exceptions

RuntimeException

protected mixed dispatchThroughMiddleware(Job $job, mixed $command)

Dispatch the given job / command through its specified middleware.

Parameters

Job $job
mixed $command

Return Value

mixed

protected mixed resolveHandler(Job $job, mixed $command)

Resolve the handler for the given command.

Parameters

Job $job
mixed $command

Return Value

mixed

protected mixed setJobInstanceIfNecessary(Job $job, mixed $instance)

Set the job instance of the given class if necessary.

Parameters

Job $job
mixed $instance

Return Value

mixed

protected void ensureNextJobInChainIsDispatched(mixed $command)

Ensure the next job in the chain is dispatched if applicable.

Parameters

mixed $command

Return Value

void

protected void ensureSuccessfulBatchJobIsRecorded(mixed $command)

Ensure the batch is notified of the successful job completion.

Parameters

mixed $command

Return Value

void

protected void ensureUniqueJobLockIsReleased(mixed $command)

Ensure the lock for a unique job is released.

Parameters

mixed $command

Return Value

void

protected bool commandShouldBeDebounced(mixed $command)

Determine if the debounced command was superseded by a newer dispatch.

Parameters

mixed $command

Return Value

bool

protected void deleteDebouncedJob(Job $job, mixed $command)

Handle a debounced (superseded) job by firing an event and deleting it.

Parameters

Job $job
mixed $command

Return Value

void

protected bool commandShouldBeUnique(mixed $command)

Determine if the given command should be unique.

Parameters

mixed $command

Return Value

bool

protected bool commandShouldBeUniqueUntilProcessing(mixed $command)

Determine if the given command should be unique until processing begins.

Parameters

mixed $command

Return Value

bool

protected void handleModelNotFound(Job $job, Throwable $e)

Handle a model not found exception.

Parameters

Job $job
Throwable $e

Return Value

void

protected void ensureUniqueJobLockIsReleasedViaContext()

Ensure the lock for a unique job is released via context.

This is required when we can't unserialize the job due to missing models.

Return Value

void

protected void ensureSuccessfulBatchJobIsRecordedForMissingModel(Job $job, string $class)

Record a potentially batched job as successful when deleted because models were missing.

Parameters

Job $job
string $class

Return Value

void

void failed(array $data, Throwable|null $e, string $uuid, Job|null $job = null)

Call the failed method on the job instance.

The exception that caused the failure will be passed.

Parameters

array $data
Throwable|null $e
string $uuid
Job|null $job

Return Value

void

protected void ensureFailedBatchJobIsRecorded(string $uuid, mixed $command, Throwable $e)

Ensure the batch is notified of the failed job.

Parameters

string $uuid
mixed $command
Throwable $e

Return Value

void

protected void ensureChainCatchCallbacksAreInvoked(string $uuid, mixed $command, Throwable $e)

Ensure the chained job catch callbacks are invoked.

Parameters

string $uuid
mixed $command
Throwable $e

Return Value

void

mixed getRunningCommand()

Get the command currently being processed.

Return Value

mixed

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.