eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.12k stars 883 forks source link

about emqx qos 2 #946

Open seqwait opened 2 years ago

seqwait commented 2 years ago

i used org.eclipse.paho.client.mqttv3[1.2.5] about QoS 2 transmission action explain https://www.emqx.com/en/blog/introduction-to-mqtt-qos it seems like after the client received PUBREC it will delete the message, but the [eclipse.paho qos] source code does not delete message action it seems like below and why it did not deleted the message

ClientState.notifyReceivedAck

else if (ack instanceof MqttPubRec) {
    // Complete the QoS 2 flow. Unlike all other
    // flows, QoS is a 2 phase flow. The second phase sends a
    // PUBREL - the operation is not complete until a PUBCOMP
    // is received
    MqttPubRel rel = new MqttPubRel((MqttPubRec) ack);
    this.send(rel, token);
}

ClientState.send

if (message instanceof MqttPingReq) {
    this.pingCommand = message;
}
else if (message instanceof MqttPubRel) {
    outboundQoS2.put( Integer.valueOf(message.getMessageId()), message);
    persistence.put(getSendConfirmPersistenceKey(message), (MqttPubRel) message);
}
else if (message instanceof MqttPubComp)  {
    persistence.remove(getReceivedPersistenceKey(message));
}