siamiondavydau/external-queue

External RabbitMQ queue for Laravel/Lumen and Yii2.

0.1.7 2022-10-03 12:58 UTC

This package is auto-updated.

Last update: 2024-10-30 01:48:10 UTC


README

Installing

composer require siamiondavydau/external-queue

Usage

Add to environment variables

EXTERNAL_RABBITMQ_HOST=
EXTERNAL_RABBITMQ_PORT=
EXTERNAL_RABBITMQ_LOGIN=
EXTERNAL_RABBITMQ_PASSWORD=

Send to the "queue_name" queue

(new Siamiondavydau\ExternalQueue\ExternalQueue())
    ->add(
        'queue_name',
        'App\Jobs\ExampleJob',
        $data
    );

Integrations

Laravel

Register service provider in config/app.php

'providers' => [
    \Siamiondavydau\ExternalQueue\Laravel\ExternalQueueServiceProvider\ExternalQueueServiceProvider::class,
]

Lumen

Register service provider in bootstrap/app.php

$app->register(\Siamiondavydau\ExternalQueue\Laravel\ExternalQueueServiceProvider\ExternalQueueServiceProvider::class);

Running the queue worker

php artisan external-queue:work --queue=queue_name

Yii2

Register module in config/console.php

$config = [
    'bootstrap' => [
        'external-queue',
    ],
    'modules' => [
        'external-queue' => [
            'class' => \Siamiondavydau\ExternalQueue\Yii\Module::class,
        ],
    ],
];

Running the queue worker

php yii external-queue/listener/work --queue=queue_name