leocarmo/php-redis-queue

1.0.0 2019-07-23 22:13 UTC

This package is auto-updated.

Last update: 2024-12-15 02:44:48 UTC


README

Scrutinizer Code Quality Build Status Code Intelligence Status Total Downloads

Starting with composer

composer require leocarmo/php-redis-queue

For examples, see examples folder on this project

The Publisher

use LeoCarmo\RedisQueue\Publisher;

$redis = new Redis();
$redis->connect('localhost');

Publisher::setQueueClient('my-queue', $redis);

Publisher::pushMessage('my-queue', [
    'message' => 'Hello World!'
]);

The Listener

use LeoCarmo\RedisQueue\Listener;

$redis = new Redis();
$redis->connect('localhost');

Listener::setQueueClient('my-queue', $redis);

Listener::restoreMessagesFromProcessingQueue('my-queue', 1);

while (true) {
    Listener::processMessages('my-queue', 1, 1, function ($events) {
        dump($events);
    });
}

Tests soon

Credits