Skip to content

Instantly share code, notes, and snippets.

@alister
Created November 22, 2011 14:44
Show Gist options
  • Save alister/1385813 to your computer and use it in GitHub Desktop.
Save alister/1385813 to your computer and use it in GitHub Desktop.
put/get Pheanstalkd
<?php
// register Pheanstalk class loader
require_once 'pheanstalk_init.php';
$pheanstalk = new Pheanstalk('127.0.0.1');
// ----------------------------------------
// producer (queues jobs)
$pheanstalk
->useTube('testtube')
->put("job payload goes here\n");
// ----------------------------------------
// worker (performs jobs)
$job = $pheanstalk->watch('testtube')
->ignore('default')
->reserve();
echo $job->getData();
$pheanstalk->delete($job);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment