2023-02-01 23:42:41 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require 'ncc';
|
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
use Tamer\Objects\JobResults;
|
|
|
|
use Tamer\Objects\Task;
|
2023-02-01 23:42:41 -05:00
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
import('net.nosial.tamerlib', 'latest');
|
2023-02-01 23:42:41 -05:00
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
$client = new \Tamer\Protocols\Gearman\Client();
|
2023-02-01 23:42:41 -05:00
|
|
|
$client->addServer();
|
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
$client->do(new Task('sleep', '5'));
|
2023-02-01 23:42:41 -05:00
|
|
|
|
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
$client->queue(new Task('sleep', '5', function(JobResults $job) {
|
2023-02-01 23:42:41 -05:00
|
|
|
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2023-02-02 21:09:45 -05:00
|
|
|
$client->queue(new Task('sleep', '5', function(JobResults $job) {
|
2023-02-01 23:42:41 -05:00
|
|
|
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
$client->run();
|