2016-08-14 11:18
浏览 2.2k


Since I have started to learn RabbitMQ I'm confused over one issue. The publisher publishes message and the consumer connects to the channel and receives the message. Means that this is a push architecture and not pull architecture where consumer will automatically receive the message when its available.

I'm in a scenario where I want to connect to the server and pull the latest message in the queue manually. I have google alot and gone through many examples and didn't come to any conclusion.

I have referred to this link lastly:

Can anyone provide me any sort of snippet in PHP in which I can pull latest message manually?

图片转代码服务由CSDN问答提供 功能建议

由于我已经开始学习RabbitMQ,我对一个问题感到困惑。 发布者发布消息,消费者连接到频道并接收消息。 这意味着这是一种推送体系结构,而不是拉结构,消费者在可用时会自动接收消息。

我正处于我想要连接到服务器并拉动 手动排队队列中的最新消息。 我有很多google并经历了很多例子并没有得出任何结论。

我最后提到了这个链接: < / a>


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douwei2825 2016-08-14 18:56

    the AMQP protocol defines a "basic consume", which is where consumers automatically receive messages from a queue.

    it also defined a "basic get", which allows you to retrieve a single message from a given queue.

    generally speaking, "consume" is what most code should do, so that messages will be received and processed as quickly as possible. but the "get" option does exist for scenarios where you don't want automatic consumption of messages.

    the PHP AMQPLib library contains a basic_get method on the channel object, for this scenario in php.

    解决 无用
    打赏 举报

相关推荐 更多相似问题