master

laravel/framework

Last updated at: 29/12/2023 09:21

QueueingDispatcher.php

TLDR

The QueueingDispatcher interface defines the contract for a dispatcher that is capable of queueing jobs and managing batches.

Methods

findBatch

Attempt to find the batch with the given ID.

  • Parameters:

    • $batchId (string): The ID of the batch to find.
  • Return Type: \Illuminate\Bus\Batch|null

batch

Create a new batch of queueable jobs.

  • Parameters:

    • $jobs (\Illuminate\Support\Collection|array): The collection or array of jobs to include in the batch.
  • Return Type: \Illuminate\Bus\PendingBatch

dispatchToQueue

Dispatch a command to its appropriate handler behind a queue.

  • Parameters:

    • $command (mixed): The command to dispatch.
  • Return Type: mixed

<?php

namespace Illuminate\Contracts\Bus;

interface QueueingDispatcher extends Dispatcher
{
    /**
     * Attempt to find the batch with the given ID.
     *
     * @param  string  $batchId
     * @return \Illuminate\Bus\Batch|null
     */
    public function findBatch(string $batchId);

    /**
     * Create a new batch of queueable jobs.
     *
     * @param  \Illuminate\Support\Collection|array  $jobs
     * @return \Illuminate\Bus\PendingBatch
     */
    public function batch($jobs);

    /**
     * Dispatch a command to its appropriate handler behind a queue.
     *
     * @param  mixed  $command
     * @return mixed
     */
    public function dispatchToQueue($command);
}