Skip to content

al-one/laravel-queue-replaceable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Queue Driver For Delayed jobs Can be replaced

暂时仅支持databaseredis以及file驱动

Installing

# composer.json

"minimum-stability": "dev",
"prefer-stable": true,
$ composer require "al-one/laravel-queue-replaceable" -vvv

Usage

# config/queue.php
<?php

return [
    'default' => env('QUEUE_DRIVER','replaceable_database'),
    'connections' => [
        'replaceable_database' => [
            'driver'      => 'replaceable_database',
            'connection'  => 'mysql', // database connection
            'table'       => 'jobs',
            'queue'       => 'default',
            'retry_after' => 90,
        ],
        'replaceable_redis' => [
            'driver'      => 'replaceable_redis',
            'connection'  => 'default', // redis connection
            'queue'       => 'default',
            'retry_after' => 90,
        ],
        'replaceable_file' => [
            'driver' => 'replaceable_file', // composer require al-one/laravel-queue-file
            //'path'   => 'app/queue', // use storage_path() if not start with "/"
            //'queue'  => 'default',
        ],
    ],
];
<?php

namespace App\Jobs;

class ProcessPodcast implements ShouldQueue
{

    public function getReplaceableId()
    {
        return 'replaceable-id';
    }

}
<?php

use App\Jobs\ProcessPodcast;

ProcessPodcast::dispatch($podcast)
    ->onConnection('replaceable_database')
    ->delay(now()->addMinutes(10));

License

MIT

About

Laravel Queue Driver For Delayed jobs Can be replaced

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages