public function createPheanstalkQueue() { $bbq = new BBQ(); $pheanstalk = new \Pheanstalk_Pheanstalk('127.0.0.1'); $bbq->registerQueue(new PheanstalkTubeQueue('queue1', $pheanstalk, 'tube1')); return $bbq; }
public function createBBQ() { $bbq = new BBQ(); $ironmq = new \IronMQ(array('token' => getenv('IRON_MQ_TOKEN'), 'project_id' => getenv('IRON_MQ_PROJECT_ID'))); $bbq->registerQueue(new IronMQQueue('ironmq_test1', $ironmq, 'test_1')); return $bbq; }
public function createBBQRedisQueue() { $bbq = new BBQ(); $predis = new \Predis\Client(); $bbq->registerQueue(new RedisQueue('queue1', $predis, 'eventio:bbq:queue1')); return $bbq; }
/** * @return BBQ */ private function createDirectoryBBQ() { $bbq = new BBQ(); $dirQueue = new DirectoryQueue('email_jobs', '/tmp/bbq/email_jobs'); $bbq->registerQueue($dirQueue); return $bbq; }
public function testGetQueue() { $queueMock = $this->getMock(__NAMESPACE__ . '\\TestQueue'); $queueMock->expects($this->once())->method('getId')->will($this->returnValue('test_id')); $this->bbq->registerQueue($queueMock); $returnedQueue = $this->bbq->getQueue('test_id'); $this->assertSame($returnedQueue, $queueMock); }
<?php require_once '../../admin/functions.php'; require_once 'Eventio/BBQ.php'; use Eventio\BBQ; use Eventio\BBQ\Queue\DirectoryQueue; use Eventio\BBQ\Job\Payload\StringPayload; define('CACHE_PATH', 'cache/bbq'); $req = get_param(); list($name, $key, $data) = null_exit($req, 'name', 'table_name', 'data', 'apikey'); items_exit($data, 'ident', 'facility', 'priority', 'message'); $bbq = new BBQ(); $queue = new DirectoryQueue('tasks', dirname(__FILE__) . '/' . CACHE_PATH); $bbq->registerQueue($queue); $bbq->pushJob('tasks', new StringPayload('New task payload')); $job = $bbq->fetchJob('tasks'); $payload = $job->getPayload(); echo $payload; $bbq->finalizeJob($job);