web浏览器上的ActiveMQ和PHP

web浏览器上的ActiveMQ和PHP,php,activemq,message-queue,Php,Activemq,Message Queue,我一直在尝试将activemq与PHP结合使用,同时通过命令行PHP脚本运行生产者和消费者。我想在浏览器中运行它。我正在使用以下代码: $queue = '/test/queue'; $msg = $data; try { $stomp = new Stomp('tcp://localhost:61613'); $stomp->send($queue, $msg." ". da

我一直在尝试将activemq与PHP结合使用,同时通过命令行PHP脚本运行生产者和消费者。我想在浏览器中运行它。我正在使用以下代码:

$queue  = '/test/queue';
        $msg    = $data;            
        try {
            $stomp = new Stomp('tcp://localhost:61613');

            $stomp->send($queue, $msg." ". date("Y-m-d H:i:s"));
            sleep(1);

        } catch(StompException $e) {
            echo 'Message: ' .$e->getMessage();

        }

        //subscribe to queue
        $stomp->subscribe($queue);

        /* read a frame */
        $frame = $stomp->readFrame();

        if ($frame->body === $msg) {
            echo $frame;

            /* acknowledge that the frame was received */
            $stomp->ack($frame);
        }

        /* close connection */
        unset($stomp);
在活动MQ web界面上,我可以看到队列中的消息已被接收,但它不会退出队列,浏览器屏幕上也不会显示任何内容。我做错什么了吗


作为一个背景-我正在尝试构建一个排队系统,在这个系统中,客户的请求可以放入队列中,并在队列处理请求后传递输出。

您想用浏览器做什么?浏览器不能直接与远程activemq服务器通信!是的,我明白了。但是如何向用户显示输出呢?请参见大气中的示例:tweeter live feed谢谢!这简化了很多事情。