-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean = false subscriber offline messages not sent in order #649
Comments
With 'stored' messages you mean retained messages or are you using |
Clean flag set to false. Client can get back the messages that are not got previously. |
I cannot find in mqtt specs something that specify how the messages should be processed in order or not while restoring a session, btw cannot you simply use the time in the payload to identify the correct order? @mcollina do you think this is an error? Should we pause client while sending session messages? |
I think this could be easily fixed by moving client.resume at the end of the emptyQueue function |
In my future development the payload may not have the time information so may not be order using it. |
Just try to move client.resume() to like below. The result is the same. |
@CWilliamL You should edit it like this: function emptyQueue (arg, done) {
const client = this.client
const persistence = client.broker.persistence
const outgoing = persistence.outgoingStream(client)
pipeline(
outgoing,
through(function clearQueue (data, enc, next) {
const packet = new QoSPacket(data, client)
// Here we are deliberatly passing only the error
// This is because there is no destination stream so the "client"
// Object filled the buffer up to the highWaterMark preventing stored messages
// being sent
packet.writeCallback = (error, _client) => next(error)
persistence.outgoingUpdate(client, packet, emptyQueueFilter)
}),
function (err) {
client.resume()
done(err)
}
)
} |
Still the same... |
Yep, sorry, that pauses the client incoming stream, so this has no effect |
The other solution would be to move the |
Just tried. The stored messages are now showed before the incoming message. However, the incoming message during restoring stored message are not shown. I can only get back those messages when I restart the subscriber. |
My guess would be that the Kind regards, |
Just noticed that the Client resume indeed only seems to pause the incoming stream. I don't have any better suggestions at this point. Cheers, |
I hosted 2 aedes brokers connected to mongodb as a cluster. I was trying to publish messages continuously (20 messages per second) and receive them in subscriber side. I noticed when I disconnected the subscriber and restart it while the publisher keeps publish messages, the stored messages were mixed with the incoming message.
E.g.
Testing {"Temperature": 19, "Time": "07/02 14:06:09", "count": 88}
Testing {"Temperature": 14, "Time": "07/02 14:06:09", "count": 89}
Testing {"Temperature": 30, "Time": "07/02 14:06:09", "count": 90}
Testing {"Temperature": 14, "Time": "07/02 14:06:09", "count": 91}
Testing {"Temperature": 10, "Time": "07/02 14:06:09", "count": 92}
Testing {"Temperature": 3, "Time": "07/02 14:06:09", "count": 93}
Testing {"Temperature": 5, "Time": "07/02 14:06:14", "count": 192} <---incoming message
Testing {"Temperature": 24, "Time": "07/02 14:06:09", "count": 94}
Testing {"Temperature": 3, "Time": "07/02 14:06:09", "count": 95}
Testing {"Temperature": 29, "Time": "07/02 14:06:09", "count": 96}
Testing {"Temperature": 27, "Time": "07/02 14:06:09", "count": 97}
Testing {"Temperature": 2, "Time": "07/02 14:06:09", "count": 98}
Testing {"Temperature": 15, "Time": "07/02 14:06:09", "count": 99}
Is there a way to fix this problem? Thank you.
The text was updated successfully, but these errors were encountered: