Skip to content

Commit

Permalink
feat: set ADD_TYPE_INFO_HEADERS to true and control it with new addTy…
Browse files Browse the repository at this point in the history
…peInfoHeader param (#138)
  • Loading branch information
amrutprabhu authored Jun 15, 2021
1 parent ba5cf9f commit 098b2b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ components:
|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`|
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
"description": "The Java package of the generated classes. Alternatively you can set the specification extension info.x-java-package",
"default": "com.asyncapi",
"required": false
},
"addTypeInfoHeader": {
"description": "Only for Kafka. Add type information to the message header",
"default": "true",
"required": false
}
},
"generator": ">=0.50.0 <2.0.0",
Expand Down
2 changes: 2 additions & 0 deletions partials/KafkaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public Map<String, Object> producerConfigs() {
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class);
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
{% if params.addTypeInfoHeader === 'false' %}
props.put(JsonSerializer.ADD_TYPE_INFO_HEADERS, false);
{% endif -%}
props.put(JsonSerializer.TYPE_MAPPINGS,
{%- for schema in asyncapi.allSchemas().values() | isObjectType %}
{%- if schema.uid() | first !== '<' and schema.type() === 'object' %}
Expand Down

0 comments on commit 098b2b8

Please sign in to comment.