Mosquitto inflight_messages = 1,但同时收到多条消息

时间:2017-03-08 10:22:06

标签: mqtt mosquitto

我已将max_inflight_messages设置为1,但在压力测试后,我的客户端同时收到多条消息。

我误解了什么吗?我想"按顺序发送消息"意味着每条消息都应该通过PUBLISH,PUBREC,PUBREL,PUBCOMP发送,然后是下一条消息。

提取mosquitto.log

1488858217: Sending PUBLISH to client (d0, q2, r0, m669, 'test/topic', ... (7 bytes))
1488858217: Sending PUBLISH to client (d0, q1, r0, m670, 'test/topic', ... (7 bytes))
1488858217: Sending PUBLISH to client (d0, q2, r0, m671, 'test/topic', ... (7 bytes))
1488858217: Sending PUBLISH to client (d0, q2, r0, m672, 'test/topic', ... (7 bytes))
1488858217: Sending PUBLISH to client (d0, q2, r0, m673, 'test/topic', ... (7 bytes))
1488858217: Received PUBREC from client (Mid: 669)
1488858217: Sending PUBREL to client (Mid: 669)
1488858217: Received PUBACK from client (Mid: 670)
1488858217: Received PUBREC from client (Mid: 671)
1488858217: Sending PUBREL to client (Mid: 671)
1488858217: Received PUBREC from client (Mid: 672)
1488858217: Sending PUBREL to client (Mid: 672)
1488858217: Received PUBREC from client (Mid: 673)
1488858217: Sending PUBREL to client (Mid: 673)

由于

此问题也发布到mosquitto/issues/393

1 个答案:

答案 0 :(得分:0)

您需要确保您的Mqtt Broker的QoS处于级别2。这将确保只接收一次所有消息,但这也会极大地影响您的性能,因为接收消息会花费很长时间。 / p>

https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels