2

We are trying to subscrib a topic named message/abc.com/broadcast by a MQTT client MQTT.fx on the ActiveMQ 5.15.8. However, the ActiveMQ console shows the subscribed topic is message.abc/com.broadcast.

enter image description here

We see the MQTT slash seperator will be converted to the dot in the ActiveMQ. But why does the ActiveMQ convert the dot to the slash as well? We would like to have a topic is message.abc.com.broadcast for the subscription and publication.

We have tried the destinationPathSeparatorPlugin of the ActiveMQ as below.

<plugins>   
        <destinationPathSeparatorPlugin pathSeparator="/" />
</plugins>

After enabling this plugin, the subscription of message/abc.com/broadcast will become message.abc.com.broadcast as shown on the ActiveMQ console. But, when we published a message to the message/abc.com/broadcast, the subscriptor will not receive any message. From the console, we can see the consumer is there(1 consumer) and the message has been enqueued and dequeued.

enter image description here

How can we make the dot/period be used in the topic name of ActiveMQ by MQTT?

Thanks

Bruce
  • 647
  • 2
  • 12
  • 30

1 Answers1

0

You are mixing protocols. ActiveMQ is compatible with several protocols like MQTT, Stomp, etc... So ActiveMQ handle his own protocol based on the other.

If you are using MQTT, the topics are created with '/' for separator, '+' for any match, and '#' for any subsecuent match.

In Active this wildcard changes and are '.' for separator, '*' for any match and '>' for any subsecuent match. For recomendation try to avoid using all of this wildcards in any topic or queue name.

So if you want to subcribe to "counts/customers", in the console it will show you this: "counts.customers"

And this it will follow:

MQTT ActiveMQ

  • "counts/customers" "counts.customers"
  • "counts/#" "counts.*"
  • "counts/+/#" "counts.*.>"
  • "counts/+/region" "counts.*.region"