Closed pbilstein closed 4 years ago
QoS 2 is not supported (it was explained many times why but long story short: it promises something it cannot deliver without cluster-wide coordination of clients and nodes, which is not practical and no MQTT implementation does) and is downgraded to QoS 1 in RabbitMQ. In most places but not for Last Will messages, apparently.
Ok, yes I understand the fact that qos 2 is not fully supported and that it should only be downgraded to 1. Thanks for clarifying the issue.
In our case we have a couple of clients out there setting last will with qos 2, which we do not have under control at the moment. Therefore, it would be very nice to have a fix here.
We understand that clients will [try to] use QoS 2. It should be downgraded everywhere gracefully.
Ok great. I had a short look at the code and changed the following part (in branch 3.7.20), which seems to fix the issue for us and our tests are still all green:
# rabbit_mqtt_processor.erl
718 delivery_mode(?QOS_0) -> 1;
719 delivery_mode(?QOS_1) -> 2.
->
# rabbit_mqtt_processor.erl
718 delivery_mode(?QOS_0) -> 1;
719 delivery_mode(?QOS_1) -> 2;
720 delivery_mode(?QOS_2) -> 2.
Maybe it helps. I guess a PR is too heavy for it, right? Or would it be appreciated?
I guess a PR is too heavy for it, right? Or would it be appreciated?
Yes, it would be appreciated, thank you
I've started looking at an integration test. We'd consider a PR (thank you!) but would only consider this issue resolve after we add a test.
Wow, that was fast. I just wanted to prepare a PR with a test and saw you already did it. Next time, I will try to be first ;-)
No worries :) You have contributed by identifying the problem and even narrowing it down to one function. That's very valuable 👍
We'll post an update to this issue when Concourse produces 3.8 and 3.7 alphas that you can use to verify.
Hi,
whenever we are setting a MQTT Last Will with QoS 2, the plugin crashes when it tries to fulfill it:
RabbitMq version: Docker rabbitmq:3.7.20-management-alpine Client Lib: mqttjs 3.0.0
When the Last Will has set qos 0 or 1, it works.