lliure/processqueue

Package for task scheduling processing in PHP extended from the lliure model

v1.3.1 2022-08-12 15:01 UTC

This package is auto-updated.

Last update: 2024-10-12 20:01:17 UTC


README

Class with the function of simply managing a process queue using the lliure-core Model

How to create the model?

namespace \Models;

use ProcessQueue\ProcessQueueModel;

class Queue extends ProcessQueueModel
{
    protected static array $fields = ['id', 'attempts']; // define your fields, is required to have id and attempts fields
    protected static ?string $table = 'queue'; // define your table
    protected static $attempts = 5; // opcional, set maximum attempts 
}

How to use?

$processes = Queue::getProcess(); //capturing available processes

foreach ($processes as $process){
    $process->start(); // starting the process

    if($myteste){
        $process->confirmProcess(); //confirming a process
    } else {
        $process->errorProcess('Erro of process'); //reporting an error
    }
}