-
-
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
feat: added mqttClientId parameter with a defualt value #295
feat: added mqttClientId parameter with a defualt value #295
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@Tenischev Please have a look. |
README.md
Outdated
|disconnectionTimeout|Only for MQTT. The completion timeout in milliseconds when disconnecting. The default disconnect completion timeout is 5000 milliseconds.|No| `5000` | | ||
|completionTimeout|Only for MQTT. The completion timeout in milliseconds for operations. The default completion timeout is 30000 milliseconds.|No| `30000` | | ||
|asyncapiFileDir| Path where original AsyncAPI file will be stored.|No| `src/main/resources/api/` | | ||
|mqttClientId| Only for MQTT. Provides the client identifier for the MQTT server.|No| guest | |
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 suggest to move it one row higher. so, all "only mqtt" parameters will be together.
- Are you sure that you need to change formatting of all rows?
- I suggest to point priority of choosing parameter more clearly e.g. "Overrides the value of the client identifier for the MQTT server, if it is set in the AsyncAPI, otherwise it provides a default 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.
Hi @Tenischev
- Updated the text and position in
README.md
andpackage.json
. - No it doesn't require formatting of all rows. In
if-elif-else
approach, the first check is to see ifparams.mqttClientId
exists. When a default value is set formqttClientID
inpackage.json
, this condition would always be true which is why I removed it and directly put the default value assignment inapplication.yml
.
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.
@Tenischev Hi, please take a look at the updated changes.
package.json
Outdated
@@ -129,6 +129,11 @@ | |||
"description": "Only for Kafka. Add type information to the message header", | |||
"default": "true", | |||
"required": false | |||
}, | |||
"mqttClientId": { | |||
"description": "Only for MQTT. Provides the client identifier for the MQTT server.", |
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.
same point about description here
{% if server.binding('mqtt') and server.binding('mqtt').clientId %}clientId: {{server.binding('mqtt').clientId}}{% endif %} | ||
{% if server.binding('mqtt') and server.binding('mqtt').cleanSession | isDefined %}cleanSession: {{server.binding('mqtt').cleanSession}}{% endif %} | ||
{% if server.binding('mqtt') and server.binding('mqtt').lastWill %}lastWill: | ||
{% if server.binding('mqtt') and server.binding('mqtt').clientId and (params.mqttClientId == 'guest') %} |
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 see the problem if in AsyncAPI server.binding('mqtt').clientId
= provider
(example), but user would like to intentionally change it to guest
via parameter.
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 see. I had an approach where I made use of an if-elif condition like this -
{% if params.mqttClientId %}
clientId : {{ params.mqttClientId }}
{% elif if server.binding('mqtt') and server.binding('mqtt').clientId %}
clientId: {{ server.binding('mqtt').clientId }}
{% else %}
clientId: defaultValue
{% endif %}
But this requires the default value to be removed from package.json
and I wasn't sure if it was better. What do you think?
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.
LGTM
🎉 This PR is included in version 0.29.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
mqttClientId
with a default valueguest
was added topackage.json
.Related issue(s)
Resolves #293