简体   繁体   中英

How to set Max Attempts For Queued Notifications in Laravel

在laravel队列系统中,当处理作业时,我可以为每个作业设置最大尝试次数 ,在作业类中添加公共字段$ tries = n本身是否可行以及如何在实现shouldQueue的通知中执行相同的操作?

It is possible in Laravel 5.7.14: https://github.com/laravel/framework/pull/26493

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class TestNotification extends Notification implements ShouldQueue
{
    use Queueable;
    public $tries = 3; // Max tries

    public $timeout = 15; // Timeout seconds
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM