-
Notifications
You must be signed in to change notification settings - Fork 49
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
add pubber missingPoint and noConfigAck options #368
Conversation
@@ -286,7 +286,11 @@ private String getMessageTopic(String deviceId, String topic) { | |||
} | |||
|
|||
private void subscribeToUpdates(MqttClient client, String deviceId) { | |||
subscribeTopic(client, String.format(CONFIG_UPDATE_TOPIC_FMT, deviceId), QOS_AT_LEAST_ONCE); | |||
Integer configQos = QOS_AT_LEAST_ONCE; // Defaults to QoS 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be "int" rather than "Integer"? Is the value ever null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to int. QoS is either 0,1, or 2. The paho mqttClient.subscribe
method expects an int when QoS is provided so don't think it's ever/can be null.
@@ -286,7 +286,11 @@ private String getMessageTopic(String deviceId, String topic) { | |||
} | |||
|
|||
private void subscribeToUpdates(MqttClient client, String deviceId) { | |||
subscribeTopic(client, String.format(CONFIG_UPDATE_TOPIC_FMT, deviceId), QOS_AT_LEAST_ONCE); | |||
Integer configQos = QOS_AT_LEAST_ONCE; // Defaults to QoS 1 | |||
if (configuration.options.noConfigAck != null && configuration.options.noConfigAck) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd typically write this as:
boolean noConfigAck = configuration.options.noConfigAck != null && configuration.options.noConfigAck;
int configQos = noConfigAck ? QOS_AT_MOST_ONCE : QOS_AT_LEAST_ONCE;
It's a bit more concise (less fluff) and is somewhat self-documenting, and prevents overwriting a defined value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Does look better. Changed, but wrapped the long line
Adds missingPoint option to remove a point from pubber, and a noConfigAck option which sets config subscription QoS to 0 (therefore no puback)