panix/mod-queue

Queue module

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:pixelion-module

dev-main 2024-09-07 11:16 UTC

This package is auto-updated.

Last update: 2024-11-07 11:43:12 UTC


README

The module collects statistics about working of queues of an application, and provides web interface for research. Also the module allows to stop and replay any jobs manually.

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License

Installation

The preferred way to install the extension is through composer. Add to the require section of your composer.json file:

$ composer require panix/mod-queue

Usage

To configure the statistics collector, you need to add monitor behavior for each queue component. Update common config file:

return [
    'components' => [
        'queue' => [
            // ...
            'as jobMonitor' => \panix\mod\queue\JobMonitor::class,
            'as workerMonitor' => \panix\mod\queue\WorkerMonitor::class,
        ],
    ],
];

There are storage options that you can configure by common config file:

return [
    'container' => [
        'singletons' => [
            \panix\mod\queue\Env::class => [
                'cache' => 'cache',
                'db' => 'db',
                'pushTableName'   => '{{%queue_push}}',
                'execTableName'   => '{{%queue_exec}}',
                'workerTableName' => '{{%queue_worker}}',
            ],
        ],
    ],
];

And apply migrations.

Web

Finally, modify your web config file to turn on web interface:

return [
    'bootstrap' => [
        'monitor',
    ],
    'modules' => [
        'monitor' => [
            'class' => \panix\mod\queue\Module::class,
        ],
    ],
];

It will be available by URL http://yourhost.com/monitor.

Console

There is console garbage collector:

'controllerMap' => [
    'monitor' => [
        'class' => \panix\mod\queue\console\GcController::class,
    ],
],

It can be executed as:

php yii monitor/clear-deprecated P1D

Where P1D is interval spec that specifies to delete all records one day older.