vert-x3 / vertx-mqtt

Vert.x MQTT
Apache License 2.0
184 stars 86 forks source link

Manual ACK on QoS 1 and 2 #235

Closed dometec closed 1 year ago

dometec commented 1 year ago

2nd PR

Added AutoAck option (default true)

old description

The problem I found in VertX MQTT Client implementation is that acknowledgment of the message is done by the library before passing the message to the application logic. So the application does not have the ability to mark the message as elaborated. In this way, MQTT messages at QoS1 or QoS2 can be lost before they can be elaborated, for example for a crash of the client, since the broker has received the acks for those messages, and for it, are successfully delivered.

I extended the message handler of the VertX client and I give the opportunity to application logic to ack the message.

A more detailed example is there: https://github.com/dometec/vertx-mqtt-flowcontrol-example

I'm sorry to not provide a unit test for it, but I think that it's not so easy...

dometec commented 1 year ago

Hi @ppatierno thanks, I fixed the indentation (and just installed editorconfig-eclipse :) )

dometec commented 1 year ago

I moved the MqttPubAckCallback interface into MqttPublishMessageImpl, because, even if it's an interface, it's something inside the library. Let me know what you think.

dometec commented 1 year ago

Hi @vietj @ppatierno, I miss something or we can move on?

vietj commented 1 year ago

are we good to merge @ppatierno ?

ppatierno commented 1 year ago

@vietj it was green for me .. waiting for you to merge. So we are good to go ;-)

vietj commented 1 year ago

thanks for the contribution @dometec

dometec commented 1 year ago

it was a pleasure ;)