【问题标题】:ActiveMQConsumer.receive(1000) returns nullActiveMQConsumer.receive(1000) 返回 null
【发布时间】:2018-05-30 16:07:30
【问题描述】:

我们正在将消息放入ACtiveMQ,我们正在使用此方法运行示例程序ActiveMessageConsumer.receive(1000) 总是返回null 消息。 即使 Queue 有消息,仍然无法接收这些消息。 url = "http://" ;

connectionFactory = new ActiveMQConnectionFactory("admin", "xxxxx", url);

connection = connectionFactory.createConnection();
((ActiveMQConnection)connection).getPrefetchPolicy().setQueuePrefetch(0);
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

destination = session.createQueue("something.sampleQ");
MessageConsumer consumer = session.createConsumer(destination);
ActiveMQObjectMessage message = (ActiveMQObjectMessage) consumer.receive(1000);

【问题讨论】:

  • 我们在while循环中运行上面的程序仍然得到相同的空响应

标签: spring jms activemq


【解决方案1】:

您的 ActiveMQ URL 应该是以下之一: http://activemq.apache.org/connection-configuration-uri.html

例如:tcp://localhost:61616

【讨论】:

  • 不,我们甚至可以使用 http/https,它可以正常工作,但现在 5.12.3 无法正常工作。
  • 好的,我明白了 - 您使用带有“host:port”的 HTTP 隧道 URI。我猜您验证了您的队列名称以及您如何在 ActiveMQ 中看到消息?
【解决方案2】:

https://issues.apache.org/jira/browse/AMQ-6823

AMQ 5.12.3 存在错误,该错误已通过 5.15.1 for http 连接器解决

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    • 2019-08-21
    • 2020-06-19
    相关资源
    最近更新 更多