tamerlib/tests/client_example.php
2023-02-01 19:22:26 -05:00

18 lines
No EOL
386 B
PHP

<?php
require 'ncc';
use Tamer\Objects\Job;
use Tamer\Objects\Task;
import('net.nosial.tamerlib', 'latest');
$client = new \Tamer\Protocols\GearmanClient();
$client->addServer();
$client->addTask(new Task('sleep', '5', function(Job $job) {
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
}));
$client->doTasks();