Beispiel #1
0
#!/usr/bin/env php
<?php 
use Beanstalk\Client as BeanstalkClient;
require_once __DIR__ . '/../vendor/autoload.php';
$beanstalk = new BeanstalkClient();
$beanstalk->connect();
$beanstalk->useTube('Example3');
$i = 0;
for ($i = 0; $i < 1; $i++) {
    $message = json_encode(array('id' => uniqid(md5(gethostname())), 'name' => 'Hello ' . $i));
    $result = $beanstalk->put(500, 0, 60, $message);
    echo $message . "\n";
}
$beanstalk->disconnect();
 public function init()
 {
     parent::init();
     $this->_client = new Client(['persistent' => $this->persistent, 'host' => $this->host, 'port' => $this->port, 'timeout' => $this->timeout]);
     $this->_client->connect();
 }