我们有本地服务总线安装。我可以使用 QPID AMQP 1.0 0.24 客户端发布和订阅/读取消息。但是队列浏览不起作用,当队列中没有更多消息时,对 hasMoreElements() 的调用会无限期挂起。堆栈跟踪是:
Thread [main] (Suspended)
waiting for: ConnectionEndpoint (id=19)
Object.wait(long) line: not available [native method]
ConnectionEndpoint(Object).wait() line: 503
Receiver.drainWait() line: 533
QueueBrowserImpl$MessageEnumeration.hasMoreElements() line: 154
Qpid.testBrowseTopic(Connection, Context) line: 209
Qpid.runTest(Qpid$Options) line: 93
Qpid.main(String[]) line: 63
编码:
ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("MS_SERVICE_BUS"); 连接 = 连接工厂.createConnection();
session = connection.createSession(false/*transacted*/, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue) context.lookup("MY_QUEUE");
browser = session.createBrowser(queue);
Enumeration<Message> msgs = browser.getEnumeration();
while (msgs.hasMoreElements()) {// hangs when there are no more messages
Message message = msgs.nextElement();
//printMessage(message);
}
QPID 0.22 的行为相同。这是 QPID 客户端或服务总线中的错误吗?
谢谢,扬