Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ Although this library is part of the [Utopia Framework](https://github.com/utopi
## Getting Started

Install using composer:

```bash
composer require utopia-php/queue
```

Init in your application:

```php
<?php

require_once __DIR__ . '/../../vendor/autoload.php';

// Create a worker using swoole adapter
// Create a worker using the Swoole adapter
use Utopia\Queue;
use Utopia\Queue\Message;

$connection = new Queue\Connection\RedisSwoole('redis');
$connection = new Queue\Connection\Redis('redis');
$adapter = new Queue\Adapter\Swoole($connection, 12, 'swoole');
$server = new Queue\Server($adapter);

Expand All @@ -49,19 +51,15 @@ $server
->start();


// Enqueue messages to the worker using swoole adapter
$connection = new RedisSwoole('redis', 6379);
run(function () use ($connection) {
$client = new Client('swoole', $connection);
go(function () use ($client) {
$client->resetStats();
// Enqueue messages to the worker using the Redis adapter
$connection = new Redis('redis', 6379);
$client = new Client('swoole', $connection);
$client->resetStats();

$client->enqueue([
'type' => 'test_number',
'value' => 123
]);
});
});
$client->enqueue([
'type' => 'test_number',
'value' => 123
]);
```

## System Requirements
Expand Down
174 changes: 0 additions & 174 deletions src/Queue/Connection/RedisSwoole.php

This file was deleted.

3 changes: 1 addition & 2 deletions tests/Queue/e2e/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PHPUnit\Framework\TestCase;
use Utopia\Queue\Client;
use Utopia\Queue\Connection\Redis;
use Utopia\Queue\Connection\RedisSwoole;

use function Swoole\Coroutine\go;
use function Swoole\Coroutine\run;
Expand Down Expand Up @@ -81,7 +80,7 @@ public function testEvents(): void

public function testSwoole(): void
{
$connection = new RedisSwoole('redis', 6379);
$connection = new Redis('redis', 6379);

run(function () use ($connection) {
$client = new Client('swoole', $connection);
Expand Down
2 changes: 1 addition & 1 deletion tests/Queue/servers/Swoole/worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Utopia\Queue;
use Utopia\Queue\Message;

$connection = new Queue\Connection\RedisSwoole('redis');
$connection = new Queue\Connection\Redis('redis');
$adapter = new Queue\Adapter\Swoole($connection, 12, 'swoole');
$server = new Queue\Server($adapter);

Expand Down