Yamamotooko
Yamamotooko

Reputation: 124

MQTT Mosquitto Broker does not sent all retained messages

I am having problems with receiving all retained messages from Mosquitto broker. The broker is started, I have a separate program which populates the broker with 3000 messages with retain set to true. When I connect using my client I only get 1020 messages. What did I miss and how to get all retained messages.

I am using a WPF app (Net Framework 4.6.2) and a python script. The result is the same with both. Also, I am using a wildcard to subscribe.

Mosquitto ver 2.0.10 Config file as follows:

acl_file ./configs/acl.acl
password_file ./configs/pwfile
allow_anonymous false
listener 8883
cafile ./certs/ca.crt
certfile ./certs/root.crt
keyfile ./certs/root.key
tls_version tlsv1.2

ACL File:

user TestUser
topic read public/read/alarm/#
topic write public/write/alarm/#

Upvotes: 3

Views: 2399

Answers (1)

Brits
Brits

Reputation: 18255

From the mosquitto man page:

max_inflight_messages count

The maximum number of outgoing QoS 1 or 2 messages that can be in the process of being transmitted simultaneously. This includes messages currently going through handshakes and messages that are being retried. Defaults to 20. Set to 0 for no maximum. If set to 1, this will guarantee in-order delivery of messages.

max_queued_messages count

The maximum number of QoS 1 or 2 messages to hold in the queue (per client) above those messages that are currently in flight. Defaults to 1000. Set to 0 for no maximum (not recommended). See also the queue_qos0_messages and max_queued_bytes options.

As your configuration does not contain either of these options the defaults of 20 (max inflight) and 1000 (max queued) kick in, so receiving a maximum of 1020 messages when you connect is the expected result. If you wish Mosquitto to store more messages then add max_queued_messages x to your mosquitto.conf (where x is the max number of messages or 0 for unlimited).

Upvotes: 4

Related Questions