public void onSuccess(Callback<Void> value) { PUBACK response = new PUBACK(); response.messageId(publish.messageId()); send(new Request(0, response.encode(), null)); if( value !=null ) { value.onSuccess(null); } } public void onFailure(Throwable value) {
public void onSuccess(Callback<Void> value) { PUBACK response = new PUBACK(); response.messageId(publish.messageId()); send(new Request(0, response.encode(), null)); if( value !=null ) { value.onSuccess(null); } } public void onFailure(Throwable value) {
@Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { if (response.isException()) { LOG.warn("Failed to send MQTT Publish: ", command, ((ExceptionResponse) response).getException()); } else { PUBACK ack = new PUBACK(); ack.messageId(command.messageId()); LOG.trace("MQTT Snd PUBACK message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(ack.encode()); } } };
@Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { if (response.isException()) { LOG.warn("Failed to send MQTT Publish: ", command, ((ExceptionResponse) response).getException()); } else { PUBACK ack = new PUBACK(); ack.messageId(command.messageId()); LOG.trace("MQTT Snd PUBACK message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(ack.encode()); } } };
@Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { if (response.isException()) { Throwable error = ((ExceptionResponse) response).getException(); LOG.warn("Failed to send MQTT Publish: ", command, error.getMessage()); LOG.trace("Error trace: {}", error); } switch (command.qos()) { case AT_LEAST_ONCE: PUBACK ack = new PUBACK(); ack.messageId(command.messageId()); LOG.trace("MQTT Snd PUBACK message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(ack.encode()); break; case EXACTLY_ONCE: PUBREC req = new PUBREC(); req.messageId(command.messageId()); synchronized (publisherRecs) { publisherRecs.put(command.messageId(), req); } LOG.trace("MQTT Snd PUBREC message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(req.encode()); break; default: break; } } };
@Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { if (response.isException()) { Throwable error = ((ExceptionResponse) response).getException(); LOG.warn("Failed to send MQTT Publish: ", command, error.getMessage()); LOG.trace("Error trace: {}", error); } switch (command.qos()) { case AT_LEAST_ONCE: PUBACK ack = new PUBACK(); ack.messageId(command.messageId()); LOG.trace("MQTT Snd PUBACK message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(ack.encode()); break; case EXACTLY_ONCE: PUBREC req = new PUBREC(); req.messageId(command.messageId()); synchronized (publisherRecs) { publisherRecs.put(command.messageId(), req); } LOG.trace("MQTT Snd PUBREC message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(req.encode()); break; default: break; } } };
@Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { if (response.isException()) { Throwable error = ((ExceptionResponse) response).getException(); LOG.warn("Failed to send MQTT Publish: ", command, error.getMessage()); LOG.trace("Error trace: {}", error); } switch (command.qos()) { case AT_LEAST_ONCE: PUBACK ack = new PUBACK(); ack.messageId(command.messageId()); LOG.trace("MQTT Snd PUBACK message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(ack.encode()); break; case EXACTLY_ONCE: PUBREC req = new PUBREC(); req.messageId(command.messageId()); synchronized (publisherRecs) { publisherRecs.put(command.messageId(), req); } LOG.trace("MQTT Snd PUBREC message:{} client:{} connection:{}", command.messageId(), clientId, connectionInfo.getConnectionId()); converter.getMQTTTransport().sendToMQTT(req.encode()); break; default: break; } } };