bokt / flarum-queue
Adds Queues to Flarum
Requires
- flarum/core: ^0.1.0-beta.9
- illuminate/queue: 5.7.*
This package is auto-updated.
Last update: 2024-12-09 02:28:34 UTC
README
This is a helper package for extension developers that adds Laravel Queue ability to Flarum.
Installation
Inside your the composer.json
of your extension add under the require section bokt/flarum-queue
:
"require": { // .. "bokt/flarum-queue": "*" }
Make sure you register the QueueProvider in your extend.php
:
return [ new \Bokt\Queue\Extend\EnableQueues, // .. your code ];
Developer instructions
In your source code you need to resolve the Illuminate\Queue\QueueManager
or
its alias queue
from the container. This allows you to push jobs into the queue.
app()->make('queue')->push(new YouHadOneJob);
Test whether your job is queued in the jobs table and by running with the flarum binary:
$ php flarum queue:work
User instructions
By default the database driver is used. You can override this by providing a queue configuration
in your config.php
under the queue
key, eg:
'database' => [ // .. ], 'queue' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, 'block_for' => null, ],
This configuration will we be bound under queue.connections.custom
and set as the default.
Other drivers are supported, check the Laravel documentation.
Database queue
Make sure you add to your user instructions the need to run:
$ php flarum queue:tables
This will migrate the jobs and failed_jobs tables into the database.