Implemented RabbitMQ and Refactored Client & Worker (WIP)

This commit is contained in:
Netkas 2023-02-02 21:09:45 -05:00
parent d15da30813
commit 6d8d4a75a4
13 changed files with 966 additions and 170 deletions

View file

@ -2,23 +2,23 @@
require 'ncc';
use Tamer\Objects\JobResults;
use Tamer\Objects\Task;
use Tamer\Objects\JobResults;
use Tamer\Objects\Task;
import('net.nosial.tamerlib', 'latest');
import('net.nosial.tamerlib', 'latest');
$client = new \Tamer\Protocols\GearmanClient();
$client = new \Tamer\Protocols\Gearman\Client();
$client->addServer();
$client->doBackground(new Task('sleep', '5'));
$client->do(new Task('sleep', '5'));
$client->addTask(new Task('sleep', '5', function(JobResults $job) {
$client->queue(new Task('sleep', '5', function(JobResults $job) {
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
}));
$client->addTask(new Task('sleep', '5', function(JobResults $job) {
$client->queue(new Task('sleep', '5', function(JobResults $job) {
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
}));