master

laravel/framework

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

Monitor.php

TLDR

The provided file Monitor.php is an interface that defines the contract for a queue monitor in the Illuminate\Contracts\Queue namespace. It specifies three methods: looping(), failing(), and stopping(), each of which registers a callback to be executed under specific conditions.

Methods

looping($callback)

This method registers a callback to be executed on every iteration through the queue loop. The callback will be executed repeatedly as long as the queue loop is running.

failing($callback)

This method registers a callback to be executed when a job fails after reaching the maximum number of retries. The callback will be executed only when a job fails permanently.

stopping($callback)

This method registers a callback to be executed when a daemon queue is stopping. The callback will be executed when the daemon queue process is about to stop or is requested to stop.

<?php

namespace Illuminate\Contracts\Queue;

interface Monitor
{
    /**
     * Register a callback to be executed on every iteration through the queue loop.
     *
     * @param  mixed  $callback
     * @return void
     */
    public function looping($callback);

    /**
     * Register a callback to be executed when a job fails after the maximum number of retries.
     *
     * @param  mixed  $callback
     * @return void
     */
    public function failing($callback);

    /**
     * Register a callback to be executed when a daemon queue is stopping.
     *
     * @param  mixed  $callback
     * @return void
     */
    public function stopping($callback);
}