Example #1
0
 public function testFastAck()
 {
     $this->client->addJob("test_queue", "body", 1000);
     $job1 = $this->client->getJob("test_queue");
     $this->client->fastAckById($job1->getId());
     $job2 = $this->client->getJob("test_queue", array('TIMEOUT' => 10));
     $this->assertNull($job2, "No more jobs");
 }
Example #2
0
<?php

use Phpque\Client;
use Phpque\Connection\ConnectionException;
require '../vendor/autoload.php';
try {
    // Connect to a server pool
    $client = new Client(['tcp://127.0.0.1:7711', 'tcp://127.0.0.1:7712']);
    // ... or to a single server
    $client = new Client('tcp://127.0.0.1:7711');
} catch (ConnectionException $e) {
    // Handle connection errors
    throw $e;
}
// Add a job with payload "some data" and timeout 1 sec
$client->addJob('test_queue', 'some data', 1000);
// Get a job from the queue
$job = $client->getJob(array('test_queue'));
// Acknowledge the job
$client->ackJob($job);