Home > Back-end >  Java MQTT subscribe to multiple topics
Java MQTT subscribe to multiple topics

Time:11-23

In a recent study MQTT MQTT subscriber Java language environment topic # can't use how to subscribe to multiple topics?
Can use the # C language environment, but the Java environment with dependence on abnormal transactions

CodePudding user response:

What is your development environment, what MQTT server (what software to run), what is the client with the jar?

CodePudding user response:

https://blog.csdn.net/qq_34309305/article/category/6853886
Subscribe to multiple topics with inside the Java/+ specific please refer to the above example

CodePudding user response:

Can be according to the parameters passed, such as different, according to the names of the subscription, publishers

CodePudding user response:

The specific look with which server support, even if is to use activeMQ server, 5 points a few began to support the MQTT protocol, can use the mqttClient corresponding package solution, mqttClient client=new mqttClient (HOST, clientid, new MemoryPersistence ()); Client. The subscribe (" topic string array ", "corresponding qos quality plastic array");
Can be addressed by a wildcard similar theme to subscribe to, is to realize the "+", single layer, such as my/+/location, you can subscribe to my/China/location and my/India/location, can use "#" wildcard multi-layer themes, such as my/China/#, implementation such as my/China/location or my/China/GPS/data, hope useful to you

CodePudding user response:

Have a similar problem, Java server-side configuration/+ and/# does not take effect, receiving less than, your problem solved

CodePudding user response:

references 9 f qq_38893509 response:
had a similar problem, Java server-side configuration/+ and/# does not take effect, receiving less than, your problem solved?

The solution? How to set the topic to have a wildcard in Java,

CodePudding user response:

Look at me to write this: https://blog.csdn.net/dotnetstudio/article/details/108119812
  • Related