dongzhan5943 2017-01-17 05:19
浏览 11

Beanstalk总是有无限循环php

Hi guys can anybody pin point me on what did i done something wrong.on my beanstalk i have create a producer the code will be on like this.

https://github.com/pda/pheanstalk/issues/159

i have an issues why it comes to this i tried adding 2 tubes with have a simple array in it.But the other i issues that i encounter its when i used the same name of the tube it doesnt have the value.It always get the value on the old.i really appreciate if you can help me guys.Sorry for wrong grammar.

<?php 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("vendor/autoload.php");
function p($s){
    echo "<pre>";
    print_r($s);
    echo "</pre>";
}
use Pheanstalk\Pheanstalk;
$pheanstalk = new Pheanstalk('127.0.0.1');  //initiating an object
$watches = $pheanstalk->watch("ashimatube103613");
if ($pheanstalk->getConnection()->isServiceListening() == true) {  
    p($job = $pheanstalk->reserve());  
    while($job = $pheanstalk->reserve()) {
        $getdata = $job->getData();     
        p($getdata);
        echo 'test this is ';   
        $pheanstalk->delete($job);
    } 
}
$start  = $pheanstalk->getConnection()->isServiceListening(); // true or false
echo $start."listening";
try {
    # $job = $pheanstalk->reserve();
    # p($job->getData());
    echo 'here test';
} catch (Exception $e) {
    echo "Error sending message - {$e->getMessage()} 
";
}

what did i done wrong?

here is my producer code producer.php

<?php 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
#echo phpinfo();
require("vendor/autoload.php");

function p($s){
    echo "<pre>";
    print_r($s);
    echo "</pre>";
}
use Pheanstalk\Pheanstalk;


$pheanstalk = new Pheanstalk('127.0.0.1');  //initiating an object

$args = array(
    "date" => "2017-1-17",
    "id"=>array("7","8","39","4")
);

#producer
$put = $pheanstalk->useTube("ashimatube103613")->put(json_encode(array($args)));
exit();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)