Controlling PUBACK in QOS1 subscription #357
-
Hi Team We are currently developing an application with a relative simple use case. Subscribing to a MQTT topic and forwarding the incoming messages to a TCP server. This application must require zero message loss and we can partially achieve this by leveraging QOS1 subscriptions and enabling persistent sessions. To fully achieve zero message loss, we also want to be in control when to send a PUBACK. We only want to send a PUBACK to the broker when we have received a positive acknowledgement from the TCP server. We did some testing and concluded that a PUBACK is sent to the broker when the
My question: is there a way of controlling when the PUBACK message is sent back to the broker without jumping through hoops? Are there maybe other ways to solve this problem? Thanks in advance!! Kind Regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Unfortunately, no, bridging is not a use case we support. This is the second inquiry we've had about it, so it may be worth factoring into our long term (unfortunately this year is already full) roadmap. |
Beta Was this translation helpful? Give feedback.
-
Hi Hans, As bretambrose mentioned, this is not possible currently. Even stopping using A different way you may be able to approach this problem without needing to disable the sending of PUBACK packets is by having the sender of the PUBLISH packet listen for a PUBLISH itself on a special topic, and then if there is not a publish received on this topic within a certain time frame, it will send the PUBLISH packet again. That way, you do not have to stop PUBACKs and have to disconnect/reconnect every time, and instead can just wait for the TCP sever to send a positive acknowledgement and only send the publish to the special topic after the TCP server sends the success. The flow would look something like this:
Happy path:
Unhappy path 01:
Unhappy path 02:
There are probably several other possibilities but hopefully that shows the general workflow you could use. An advantage of this is that it allows you to control the possibility for data loss and disconnections entirely on both the server and client side. For example, this solution allows you to write code to handle the case where you cannot get a successful response after trying to send it 10+ times, which would be harder to handle and process if you were just relying on waiting for a PUBACK. If you can, a solution like the above should allow you to handle the situation and get no data loss, while also not needing to stop sending PUBACKs. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Unfortunately, no, bridging is not a use case we support. This is the second inquiry we've had about it, so it may be worth factoring into our long term (unfortunately this year is already full) roadmap.