【问题标题】:Asynchronously queue processing with RabbitMQ使用 RabbitMQ 进行异步队列处理
【发布时间】:2014-09-09 11:30:22
【问题描述】:

我在 RabbitMQ 中寻找异步队列处理的好例子时遇到了问题。
我试图开始在服务器端实现这样的东西:

//here I declare the connection exchange and queue
$this->connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
$this->channel = $this->connection->channel();            
$this->channel->exchange_declare("exchange", 'direct', false, false, false);
list($this->queue_name, ,) = $this->channel->queue_declare("Queue", false, false, true, false);

while($envelope = $queue->get()) 
{
    // do work here...
}

问题是我返回的是队列名称而不是队列引用,因此我将能够在以下while 循环中使用它。

我也尝试创建和声明一个队列,如this link 中所写,但我的RabbitMQ 交付包中没有AMQPQueue 之类的类。

有人知道如何获取队列实例以便能够使用get 方法吗?

【问题讨论】:

    标签: php rabbitmq


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-10
    • 1970-01-01
    • 2019-11-05
    • 2023-03-24
    • 1970-01-01
    • 2020-06-15
    相关资源
    最近更新 更多