fusesource / mqtt-client

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

Listener deprecated but not documented #71

Open francisdb opened 8 years ago

francisdb commented 8 years ago

org.fusesource.mqtt.client.Listener is annotated with @Deprecated but there is no reference to the new way of doing things

kegeman commented 6 years ago

This is still the issue...

kurrunk37 commented 6 years ago

This is still the issue...

calcao commented 6 years ago

This is still the issue...

cnazev commented 5 years ago

This is still the issue...

leonpros commented 4 years ago

any news on that?

lvskk commented 3 years ago

Just to close the issue.

org.fusesource.mqtt.client.Listener was deprecated in favor of org.fusesource.mqtt.client.ExtendedListener.

The new usage as I could understand from the code is as follows (please, correct me if I'm wrong):

    connection.listener(new ExtendedListener() {
        public void onPublish(UTF8Buffer utf8Buffer, Buffer buffer, Callback<Callback<Void>> callback) {
            callback.onSuccess(new Callback<Void>() {
                public void onSuccess(Void aVoid) {
                    System.out.println(new String(buffer.toByteArray()));
                }
                public void onFailure(Throwable throwable) {}
            });
        }
        public void onDisconnected() {}
        public void onConnected() {}
        public void onPublish(UTF8Buffer topic, Buffer payload, Runnable ack) {}
        public void onFailure(Throwable value) {
            value.printStackTrace();
        }
    });