[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [paho-dev] Question about message persistence
|
The MQTT specification states how the message
delivery quality of service works once a message has been accepted for
delivery
The Paho Java client follows this i.e.
once the the client has accepted the message then it will ensure the quality
of service for delivery is met. If the client is not in connected
state then it will refuse to accept the message until the client is connected
to the MQTT server.
One of the top requests for enhancement
is to add an offline / buffer capability to the client so that it will
accept messages when not connected.
All the best
Dave
From:
Herman <ssjherman@xxxxxxxxx>
To:
paho-dev@xxxxxxxxxxx
Date:
15/12/2014 14:41
Subject:
[paho-dev] Question
about message persistence
Sent by:
paho-dev-bounces@xxxxxxxxxxx
Hi all,
I was looking into how a QoS level of 1 (messages sent
at least once) was implemented in the Eclipse Paho Mqtt Java Client library,
and noticed that this level is only ensured if the client is connected.
In case the app tries to publish messages while it isn't connected, the
messages just get discarded instead of 'queued' for re-sending (in the
form of the .msg files) once the client re-connects. Is this how it actually
works?
The particular code snipped I was looking at was this
in ClientComms.java:
public void sendNoWait(MqttWireMessage message, MqttToken
token) throws MqttException {
final String methodName = "sendNoWait";
if (isConnected() || //
<- this check would fail (as would the others below), so it would never
go to internalSend, which ultimately leads to saving the message on disk.
But instead just throws the Exception.
(!isConnected() && message instanceof MqttConnect)
||
(isDisconnecting() && message instanceof MqttDisconnect))
{
this.internalSend(message, token);
} else {
//@TRACE 208=failed: not connected
log.fine(className, methodName, "208");
throw ExceptionHelper.createMqttException(MqttException.REASON_CODE_CLIENT_NOT_CONNECTED);
}
}
If this is the case, is it not a violation of the QoS
level of 1? Would I be able to request this particular feature?
In addition, is there any sample code that you have which
would do what I described above? Or any advice on how to implement this
particular functionality ourselves?
Thank you so much for your help,
Sincerely,
Herman_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU