Skip to content

persistent session do not receive missed messages #3202

@Corentin-Luc-Artaud

Description

@Corentin-Luc-Artaud

It seems that missed messages are not forwarded to persistent sessions on reconnect, using mosquitto_sub with options -c and -i sets with a Qos of 2 and messages published with a Qos of 2 or 1.

I have seen this behavior with mosquitto 2.0.15 and 2.0.20 in docker
with the following configuration.

per_listener_settings true

listener 1883
allow_anonymous true
protocol mqtt

max_queued_messages 1000
#Same behavior `queue_qos0_messages true`
queue_qos0_messages true
#Same behavior without persistence
persistence true

the compose file used to start the service

name: "mosquitto"

services:
  mosquitto-1:
    image: "eclipse-mosquitto:2.0.15-openssl"
    user: "1000:1000"
    volumes:
      - "./mosquitto.conf:/mosquitto/config/mosquitto.conf"
    ports:
      - 1883:1883

and there is the script used to test the behavior of persistent session

#/bin/sh

mosquitto_sub -h localhost -p 1883 -c -i persistent -t "greetings" -q 2 -v -d &
sub_pid=$!

mosquitto_pub -h localhost -p 1883 -c -i publisher -t "greetings" -m "hi" -q 2 -d
sleep 1
kill $sub_pid
sleep 1

mosquitto_pub -h localhost -p 1883 -c -i publisher -t "greetings" -m "hi no subscriber" -q 2 -d 
sleep 1
mosquitto_sub -h localhost -p 1883 -c -i persistent -t "greetings" -q 2 -v -d &
sub_pid=$!
sleep 10
kill $sub_pid

I need this feature for a project, may you explain what i missed to have it working ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: AvailableNo one has claimed responsibility for resolving this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions