paho.mqtt.java icon indicating copy to clipboard operation
paho.mqtt.java copied to clipboard

about emqx qos 2

Open seqwait opened this issue 3 years ago • 0 comments

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));
}

seqwait avatar Jul 25 '22 08:07 seqwait