Node.js amqp的nodejs rhea npm无法';t在activemq artemis中的地址上创建订阅队列
我的地址“pubsub.foo”已经在Node.js amqp的nodejs rhea npm无法';t在activemq artemis中的地址上创建订阅队列,node.js,activemq-artemis,rhea,Node.js,Activemq Artemis,Rhea,我的地址“pubsub.foo”已经在broker.xml中配置为多播 : 当客户端连接到具有多播元素的地址时,将自动为客户端创建一个订阅队列 我正在使用rhea AMQP Node.js npm创建一个简单的实用程序,以将消息发布到该地址 var connection=require('rhea').connect({port:args.port,host:args.host,用户名:'admin',密码:'xxxx'}); var sender=connection.open_sender(
broker.xml
中配置为多播
:
当客户端连接到具有多播元素的地址时,将自动为客户端创建一个订阅队列
我正在使用rhea AMQP Node.js npm创建一个简单的实用程序,以将消息发布到该地址
var connection=require('rhea').connect({port:args.port,host:args.host,用户名:'admin',密码:'xxxx'});
var sender=connection.open_sender('pubsub.foo');
sender.on('sendable',函数(上下文){
var m=‘Hii测试’
console.log('sent'+m);
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.foo
,pubsub.foo::client1
,但是客户端代码没有带来好运。请分享你的想法。我不熟悉ActiveMQ Artemis
你观察到的实际上是预期的行为
不幸的是,您引用的文档并不像可能的那样清晰。当它说将创建订阅队列以响应连接的客户端时,实际上是指订阅者而不是生产者。这就是它创建订阅队列的原因。多播地址(以及一般的发布/订阅)的语义规定,当没有订户时发送的消息将被丢弃。因此,您需要创建一个订户,然后发送一条消息
如果您想要不同的语义,那么我建议您使用anycast