【发布时间】:2014-06-25 13:44:12
【问题描述】:
我目前正在使用 stomp 在 activemq 队列中发送和接收/消费消息,但是 stomp 消费者正在同步工作,这意味着 stomp 消费者会不断检查队列中是否有任何新消息。但我需要做的是当有新消息进入队列时,让 activemq 通知我的 stomp 消费者。例如 Java 中的 Onmessage() 方法。我搜索了几天,但仍然没有运气。 我当前的 php 代码(我如何使用 stomp 从队列中读取消息):
while (true) {
$frame = $stomp->readFrame();
if ($frame != NULL) {
print "Received: " . $frame->body . " - time now is " . date("Y-m-d H:i:s"). "\n";
$stomp->ack($frame);
}
else {
print "No frames to read\n";
}
【问题讨论】:
-
这将是你的 php STOMP 客户端的一个特性,所以请让人们知道你在使用什么。
-
好吧,任何 php 的任何工作解决方案,stomp 版本都可以,如果需要我可以更新版本。
-
github.com/reactphp/stomp 似乎支持你想要的,但似乎只支持 STOMP 1.0
-
谢谢@Buchi。 github.com/reactphp/stomp ,它是异步的,并且有很多好的特性。
标签: php activemq message-queue stomp messagebroker