0

I have an address "pubsub.foo" already configured as multicast in broker.xml.

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

As per the Artemis documentation:

When clients connect to an address with the multicast element, a subscription queue for the client will be automatically created for the client.

I am creating a simple utility using rhea AMQP Node.js npm to publish messages to the address.

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();
});

I enabled debug log and while running the client code I see the message like this.

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

I also tried different variations of the topic, for example, client1.pubsub.foo, pubsub.foo::client1 however no luck from the client code. Please share your thoughts. I am new to ActiveMQ Artemis.

enter image description here

4

1 回答 1

1

What you're observing actually is the expected behavior.

Unfortunately, the documentation you cited isn't as clear as it could be. When it says a subscription queue will be created in response to a client connecting it really means a subscriber not a producer. That's why it creates a subscription queue. The semantics for a multicast address (and publish/subscribe in general) dictate that a message sent when there are no subscribers will be dropped. Therefore, you need to create a subscriber and then send a message.

If you want different semantics then I recommend you use anycast.

于 2020-02-04T09:55:54.637 回答