-
Notifications
You must be signed in to change notification settings - Fork 55
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
Added option to turn shared subscription off or change the group identifier #624
Conversation
@fbuedding Thank you so much for your contribution. This PR LGTM. Before merging is required a twin PR under https://github.com/telefonicaid/iotagent-json repo adding the same feature. Once we have open that PR, we can merge both |
Hello! Thank you! Do I have to open the twin PR? Sorry in advanced if I missed that! |
Yes. That's correct. Please open a twin PR in the https://github.com/telefonicaid/iotagent-json repo, with the same feature implemented here.
Don't worry! :) |
lib/bindings/MQTTBinding.js
Outdated
constants.MQTT_TOPIC_PROTOCOL + | ||
'/+/+/' + | ||
constants.CONFIGURATION_SUFIX + | ||
if (config.getConfig().mqtt.sharedSubscriptionsDisabled === true) { |
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.
In order to not duplicate all topics code:
Why not
if (config.getConfig().mqtt.sharedSubscriptionsDisabled === true)
MQTT_SHARE_SUBSCRIPTON_GROUP_VAR = "";
else
MQTT_SHARE_SUBSCRIPTON_GROUP_VAR = constants.MQTT_SHARE_SUBSCRIPTION_GROUP
and then use the same block but instead of constants.MQTT_SHARE_SUBSCRIPTION_GROUP use MQTT_SHARE_SUBSCRIPTON_GROUP_VAR ?
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.
My original thinking was that I wanted to keep as much original code as possible, but the way you described is indeed better and more elegant. Changed it and tests are passing.
I'm not sure why the tests are failing or timing out, here are my results for Node 14.x 145 passing (14s)
|
pnpm-lock.yaml
Outdated
@@ -0,0 +1,6143 @@ | |||
lockfileVersion: '6.0' |
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.
You should remove this file from PR
I investigated why the test are sometimes failing and I think it is just some timeout issue. After that I tried to reproduce the same on the unmodified branch and the tests are also sometimes failing. After my changes it became more frequent since I'm repeating the tests with different configurations. If there is something I can do or I have to do, pls let me know @AlvaroVega @mapedraza Kind regards |
You are right. There is 1 test case related with MQTT that sometime fails. A re-run of the tests use to fix the problem, although it is a annoying glitch. If the changes introduced by your PR increase the probablity of this fail, the severity of this problem could change from "annyoing" to "blocking". Thus, maybe it's a good moment to investigate the cause of the problem and provide a fix. That could be done in an independent PR, for the sake of clearness. @fbuedding what do you think? could you do that investigation/fix proposal, please? |
@fgalan Yes I will look into this! |
@fbuedding it seems this PR has been closed... could you elaborate on the reason, please? Thanks! |
Hello, I'm sorry if thats the wrong pull request etiquette, this is the first one I ever did on a bigger project. |
No problem. It's perfectly fine with request etiquette :) I was just to know the reason behind the closing. |
I've noticed that the IoT-Agent UL is using shared MQTT subscriptions. On top of that I couldn't find any documentation regarding to this. It was introduced in this
commit
.While I think the reasoning behind this is correct and needed, I don't think there is any drawback from adding a feature to make this more configurable.
Use cases:
Behaviour
Changes made:
All in all this is a minor change since it is backwards compatible and only adds features for edge cases. All tests are passing (The three pending tests were also pending before and are located in 'HTTP Transport binding: polling commands').
145 passing (14s)
3 pending