vert-x3 / vertx-mqtt

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

Unable to control ackowledgement of the message #200

Closed ctron closed 1 year ago

ctron commented 3 years ago

Currently it is not possible to control the acknowledgement of an MQTT message, as the client auto-acknowledges messages.

Version

Context

Receiving messages.

Extra

Using QoS 1, the client currently auto-acknowledges messages received from a server, it also does this before calling the user provided handler:

https://github.com/vert-x3/vertx-mqtt/blob/5455c484347bdaf854fdd556653ea37b29ff860d/src/main/java/io/vertx/mqtt/impl/MqttClientImpl.java#L1191-L1195

Taking a look at section "4.3.2" and figure "Figure 4.2" of the MQTT v3.1.1 spec, you can see that the acknowledgement must be sent, after the receiver has taken ownership of the message.

However, the MQTT client being an un-opinionated MQTT client, should not acknowledge a message before it has passed it on the application level code, which ultimately takes ownership of the message.

vietj commented 3 years ago

does it mean that the message object could have an ack() method and we should have an auto-ack message option that would perform the current ack for retro compatibility ?

ppatierno commented 3 years ago

I would agree with Julien but leaving autoack as default for backward compatibility of course.

tsegismont commented 3 years ago

@ctron would you like to contribute?

ctron commented 3 years ago

I could draft up a PR. However I am not sure I can find the time to follow up on this to get it merged. I think this should come from the project.

SivaAkiro commented 2 years ago

can i take this feature? Please provide some information regarding this.

vietj commented 2 years ago

@SivaAkiro yes you can, you can read the contribution guidelines

SivaAkiro commented 2 years ago

Thanks, can I get some.information about this ticket.

SivaAkiro commented 2 years ago

Thanks, can I get some.information about this ticket.

vietj commented 2 years ago
vietj commented 2 years ago

yes and also server options

On Mon, Aug 1, 2022 at 9:15 PM SivaAkiro @.***> wrote:

Question, Options means MQTTClientOptions right?

— Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-mqtt/issues/200#issuecomment-1201610723, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXDCQROPXWKVCH7D3EHLTVXAO6VANCNFSM45UXN4YQ . You are receiving this because you commented.Message ID: @.***>

SivaAkiro commented 2 years ago

For QoS 1 every message, we need to check the whether this message should be auto ack or not. Default, all the messages will get auto-ack, if not user has to manually call the ack method.

We need to add the isAutoAck() in MqttPublishMessage Class and all the message which is received by the Client, will validate against this param?

Is my understanding correct?

ppatierno commented 2 years ago

No, you have the auto-ack boolean flag in the options ... so you have to check against it. A PUBLISH message cannot bring the information that it has to be auto-ack or not. It's a client or server configuration as we said.

dometec commented 1 year ago

I all, I think this issue can be closed since #235 is merged.

ppatierno commented 1 year ago

Closed with #235