Skip to content

Commit

Permalink
Implemented request changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VaishnaviNandakumar committed May 19, 2023
1 parent 2d8bd09 commit d5a792a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ In order for the generator to know what names to use for some parameters it's ne

#### Supported parameters

|Name|Description|Required| Default |
|---|---|---|---------------------------|
|disableEqualsHashCode|Disable generation of equals and hashCode methods for model classes.|No| `false` |
|inverseOperations|Generate an application that will publish messages to `publish` operation of channels and read messages from `subscribe` operation of channels. Literally this flag will simply swap `publish` and `subscribe` operations in the channels. <br> This flag will be useful when you want to generate a code of mock for your main application. Be aware, generation could be incomplete and manual changes will be required e.g. if bindings are defined only for case of main application.|No| `false` |
|javaPackage|The Java package of the generated classes. Alternatively you can set the specification extension `info.x-java-package`. If both extension and parameter are used, parameter has more priority.|No| `com.asyncapi` |
|listenerPollTimeout|Only for Kafka. Timeout in ms to use when polling the consumer.|No| `3000` |
|listenerConcurrency|Only for Kafka. Number of threads to run in the listener containers.|No| `3` |
|addTypeInfoHeader|Only for Kafka. Add type information to message header.|No| `true` |
|connectionTimeout|Only for MQTT. This value, measured in seconds, defines the maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails.|No| `30` |
|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` |
|Name|Description|Required| Default |
|---|---|---|----------------------|
|disableEqualsHashCode|Disable generation of equals and hashCode methods for model classes.|No| `false` |
|inverseOperations|Generate an application that will publish messages to `publish` operation of channels and read messages from `subscribe` operation of channels. Literally this flag will simply swap `publish` and `subscribe` operations in the channels. <br> This flag will be useful when you want to generate a code of mock for your main application. Be aware, generation could be incomplete and manual changes will be required e.g. if bindings are defined only for case of main application.|No| `false` |
|javaPackage|The Java package of the generated classes. Alternatively you can set the specification extension `info.x-java-package`. If both extension and parameter are used, parameter has more priority.|No| `com.asyncapi` |
|listenerPollTimeout|Only for Kafka. Timeout in ms to use when polling the consumer.|No| `3000` |
|listenerConcurrency|Only for Kafka. Number of threads to run in the listener containers.|No| `3` |
|addTypeInfoHeader|Only for Kafka. Add type information to message header.|No| `true` |
|connectionTimeout|Only for MQTT. This value, measured in seconds, defines the maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails.|No| `30` |
|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` |
|mqttClientId| Only for MQTT. Provides the client identifier for the MQTT server. This parameter overrides the value of the clientId if it's set in the AsyncAPI file.If both aren't provided, a default value is set.|No| |
|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 |
#### Examples

The shortest possible syntax:
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
"default": 30000,
"required": false
},
"mqttClientId": {
"description": "Only for MQTT. Provides the client identifier for the MQTT server. This parameter overrides the value of the clientId if it's set in the AsyncAPI file.",
"required": false
},
"asyncapiFileDir": {
"description": "Parameter of @asyncapi/generator-hooks#createAsyncapiFile, allows to specify where original AsyncAPI file will be stored.",
"default": "src/main/resources/api/",
Expand All @@ -129,11 +133,6 @@
"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.",
"default": "guest",
"required": false
}
},
"generator": ">=1.8.27 <2.0.0",
Expand Down
10 changes: 6 additions & 4 deletions template/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ mqtt:
address: {% if server.variable('port') %}{{server.url() | replace('{port}', server.variable('port').defaultValue())}}{% else %}{{server.url()}}{% endif %}
username:
password:
{% if server.binding('mqtt') and server.binding('mqtt').clientId and (params.mqttClientId == 'guest') %}
{% if params.mqttClientId %}
clientId : {{ params.mqttClientId }}
{% elif server.binding('mqtt') and server.binding('mqtt').clientId %}
clientId: {{ server.binding('mqtt').clientId }}
{% else %}
clientId: {{ params.mqttClientId }}
clientId: default
{% 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').cleanSession | isDefined %}cleanSession: {{server.binding('mqtt').cleanSession}}{% endif %}
{% if server.binding('mqtt') and server.binding('mqtt').lastWill %}lastWill:
topic: {{server.binding('mqtt').lastWill.topic}}
message: {{server.binding('mqtt').lastWill.message}}
qos: {{server.binding('mqtt').lastWill.qos}}
Expand Down

0 comments on commit d5a792a

Please sign in to comment.