fusesource / mqtt-client

A Java MQTT Client
http://mqtt-client.fusesource.org/
Apache License 2.0
1.27k stars 369 forks source link

receive all the times #95

Open NoPerfectName opened 6 years ago

NoPerfectName commented 6 years ago

I use the blocking connection api ,when I receive the message and then "message.ack()",but I can receive the message again on the next time,what is wrong?

connection = mqtt.blockingConnection();
 connection.connect();
connection.subscribe(topics);
while (true) {             
                Message message = connection.receive();
                String receiveMessage = String.valueOf(UTF8Buffer.utf8(message.getPayloadBuffer()));
                System.out.println(receiveMessage);
                message.ack();
}
Vivien- commented 5 years ago

Hi, how did you solve this issue ? I use the future API but am facing the same issue : I can only fetch 1 notification but there is not really a way to subscribe to any notification from a topic ?