wuwuseo/hibiken-asynq-client

go hibiken/asynq client

1.0.1 2023-10-07 10:33 UTC

This package is auto-updated.

Last update: 2024-05-07 12:09:56 UTC


README

This is a client for the hibiken/asynq GO task queue used to send asynq tasks in PHP.

Asynq issues Client in other languages

hibiken/asynq#105 (comment) hibiken/asynq#105 (comment)

Asynq

https://github.com/hibiken/asynq Asynq is a Go library for queueing tasks and processing them asynchronously with workers. It's backed by Redis and is designed to be scalable yet easy to get started.

required

"php": "^8.1",
"ext-redis": "^5.3",

install

composer require wuwuseo/hibiken-asynq-client:dev-main

used

use Client to put tasks on queues.

example

namespace Wuwuseo\HibikenAsynqClient\Tests;

use Ramsey\Uuid\Uuid;
use Wuwuseo\HibikenAsynqClient\Client;

class ClientTest extends \PHPUnit\Framework\TestCase
{
    public function testEnqueue()
    {
        $redis = new \Redis();
        $redis->connect('127.0.0.1');
        $clinet = new Client($redis);
        $res = $clinet->Enqueue([
            'typename'=>'newtest:user:xxxx',
            'payload'=>[
                'test'=>'xxxx',
                'user'=>1111
            ],
            'opts'=>[
                'timeout'=>0,
            ]
        ],[
            'queue'=>'test'        
        ]);
        $this->assertTrue($res);
    }
}