lliure / processqueue
基于 lliure 模型的 PHP 任务调度处理包
v1.3.1
2022-08-12 15:01 UTC
Requires
- php: >=7.4 || >= 8.0
- lliure/lliure-core: ^v5.3 || ^v6
README
使用 lliure-core 模型简单地管理进程队列的类
如何创建模型?
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
}
如何使用?
$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
}
}