i am using eclipse.paho.client.mqttv3-1.0.2.jar to subscribe and publish data i need to subscribe to multiple level of topics, according to http://mosquitto.org/man/mqtt-7.html we can use some wildcard option to subscribe all remaining levels of hierarchy. but when i try with mqttv3-1.0.2.jar i got an exception the topic name must not contain any wildcard characters # + with the following code:
String myTopicACK = "DATA/#";
int subQoS = 2;
myClient.subscribe(myTopicACK, subQoS);
i also tried with topic "DATA/*" somewhere i read that * is used for one level hierarchy. but no success.
Exception is
java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)
at org.eclipse.paho.client.mqttv3.MqttTopic.validate(MqttTopic.java:202)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.getTopic(MqttAsyncClient.java:637)
at org.eclipse.paho.client.mqttv3.MqttClient.getTopic(MqttClient.java:429)
at PublishMe.runClient(PublishMe.java:154)
at PublishMe.main(PublishMe.java:100)