Skip to content
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

Merged
merged 5 commits into from
Jun 30, 2022

Conversation

noursaidi
Copy link
Collaborator

Adds missingPoint option to remove a point from pubber, and a noConfigAck option which sets config subscription QoS to 0 (therefore no puback)

@noursaidi noursaidi requested a review from grafnu June 21, 2022 13:50
@@ -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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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) {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

@noursaidi noursaidi requested a review from grafnu June 29, 2022 12:20
@noursaidi noursaidi merged commit 1640c2b into faucetsdn:master Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants