【问题标题】:nodejs rhea npm for amqp couldn't create subscription queue on address in activemq artemisamqp的nodejs rhea npm无法在activemq artemis的地址上创建订阅队列
【发布时间】:2020-05-19 20:46:58
【问题描述】:

我有一个地址“pubsub.foo”已经在broker.xml 中配置为多播。

<address name="pubsub.foo">
   <multicast/>
</address>

根据Artemis documentation

当客户端连接到具有多播元素的地址时,将自动为客户端创建客户端订阅队列。

我正在创建一个简单的实用程序,使用 rhea AMQP Node.js npm 将消息发布到地址。

var connection = require('rhea').connect({ port: args.port, host: args.host, username:'admin', password:'xxxx' });

var sender = connection.open_sender('pubsub.foo');
sender.on('sendable', function(context) {
    var m = 'Hii test' 
    console.log('sent ' + m);
    sender.send({body:m});
    connection.close();
});

我启用了调试日志,并在运行客户端代码时看到这样的消息。

2020-02-03 22:43:25,071 DEBUG [org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl] Message org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage@68933e4b is not going anywhere as it didn't have a binding on address:pubsub.foo

我还尝试了该主题的不同变体,例如,client1.pubsub.foopubsub.foo::client1,但是客户端代码没有运气。请分享你的想法。我是 ActiveMQ Artemis 的新手。

【问题讨论】:

    标签: node.js activemq-artemis rhea


    【解决方案1】:

    您实际观察到的是预期的行为。

    很遗憾,您引用的文档并没有尽可能清晰。当它说将创建订阅队列以响应连接的客户端时,它实际上意味着 订阅者 而不是生产者。这就是它创建 subscription 队列的原因。多播地址(以及一般的发布/订阅)的语义规定,当没有订阅者时发送的消息将被丢弃。因此,您需要创建一个订阅者并然后发送一条消息。

    如果你想要不同的语义,那么我建议你使用任播。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-24
      • 2021-06-09
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-30
      • 2021-08-08
      相关资源
      最近更新 更多