Commit b82525ae864e49085cf0916aad691421505e3208
1 parent
2658de71
added consumerPropertiesPerTopic to transport yml
Showing
5 changed files
with
25 additions
and
6 deletions
... | ... | @@ -19,6 +19,7 @@ import lombok.Getter; |
19 | 19 | import org.springframework.beans.factory.annotation.Value; |
20 | 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
21 | 21 | import org.springframework.stereotype.Component; |
22 | +import org.thingsboard.server.common.data.StringUtils; | |
22 | 23 | |
23 | 24 | import javax.annotation.PostConstruct; |
24 | 25 | import java.util.HashMap; |
... | ... | @@ -37,7 +38,7 @@ public class TbKafkaTopicConfigs { |
37 | 38 | private String notificationsProperties; |
38 | 39 | @Value("${queue.kafka.topic-properties.js-executor}") |
39 | 40 | private String jsExecutorProperties; |
40 | - @Value("${queue.kafka.topic-properties.fw-updates}") | |
41 | + @Value("${queue.kafka.topic-properties.fw-updates:}") | |
41 | 42 | private String fwUpdatesProperties; |
42 | 43 | |
43 | 44 | @Getter |
... | ... | @@ -65,11 +66,13 @@ public class TbKafkaTopicConfigs { |
65 | 66 | |
66 | 67 | private Map<String, String> getConfigs(String properties) { |
67 | 68 | Map<String, String> configs = new HashMap<>(); |
68 | - for (String property : properties.split(";")) { | |
69 | - int delimiterPosition = property.indexOf(":"); | |
70 | - String key = property.substring(0, delimiterPosition); | |
71 | - String value = property.substring(delimiterPosition + 1); | |
72 | - configs.put(key, value); | |
69 | + if (StringUtils.isNotEmpty(properties)) { | |
70 | + for (String property : properties.split(";")) { | |
71 | + int delimiterPosition = property.indexOf(":"); | |
72 | + String key = property.substring(0, delimiterPosition); | |
73 | + String value = property.substring(delimiterPosition + 1); | |
74 | + configs.put(key, value); | |
75 | + } | |
73 | 76 | } |
74 | 77 | return configs; |
75 | 78 | } | ... | ... |
... | ... | @@ -136,6 +136,10 @@ queue: |
136 | 136 | sasl.mechanism: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM:PLAIN}" |
137 | 137 | sasl.config: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG:org.apache.kafka.common.security.plain.PlainLoginModule required username=\"CLUSTER_API_KEY\" password=\"CLUSTER_API_SECRET\";}" |
138 | 138 | security.protocol: "${TB_QUEUE_KAFKA_CONFLUENT_SECURITY_PROTOCOL:SASL_SSL}" |
139 | + consumerPropertiesPerTopic: | |
140 | + tb_firmware: | |
141 | + - key: max.poll.records | |
142 | + value: 10 | |
139 | 143 | other: |
140 | 144 | topic-properties: |
141 | 145 | rule-engine: "${TB_QUEUE_KAFKA_RE_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:26214400;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" | ... | ... |
... | ... | @@ -108,6 +108,10 @@ queue: |
108 | 108 | sasl.mechanism: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM:PLAIN}" |
109 | 109 | sasl.config: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG:org.apache.kafka.common.security.plain.PlainLoginModule required username=\"CLUSTER_API_KEY\" password=\"CLUSTER_API_SECRET\";}" |
110 | 110 | security.protocol: "${TB_QUEUE_KAFKA_CONFLUENT_SECURITY_PROTOCOL:SASL_SSL}" |
111 | + consumerPropertiesPerTopic: | |
112 | + tb_firmware: | |
113 | + - key: max.poll.records | |
114 | + value: 10 | |
111 | 115 | other: |
112 | 116 | topic-properties: |
113 | 117 | rule-engine: "${TB_QUEUE_KAFKA_RE_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:26214400;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" | ... | ... |
... | ... | @@ -174,6 +174,10 @@ queue: |
174 | 174 | sasl.mechanism: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM:PLAIN}" |
175 | 175 | sasl.config: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG:org.apache.kafka.common.security.plain.PlainLoginModule required username=\"CLUSTER_API_KEY\" password=\"CLUSTER_API_SECRET\";}" |
176 | 176 | security.protocol: "${TB_QUEUE_KAFKA_CONFLUENT_SECURITY_PROTOCOL:SASL_SSL}" |
177 | + consumerPropertiesPerTopic: | |
178 | + tb_firmware: | |
179 | + - key: max.poll.records | |
180 | + value: 10 | |
177 | 181 | other: |
178 | 182 | topic-properties: |
179 | 183 | rule-engine: "${TB_QUEUE_KAFKA_RE_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:26214400;retention.bytes:1048576000;partitions:1}" | ... | ... |
... | ... | @@ -136,6 +136,10 @@ queue: |
136 | 136 | sasl.mechanism: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM:PLAIN}" |
137 | 137 | sasl.config: "${TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG:org.apache.kafka.common.security.plain.PlainLoginModule required username=\"CLUSTER_API_KEY\" password=\"CLUSTER_API_SECRET\";}" |
138 | 138 | security.protocol: "${TB_QUEUE_KAFKA_CONFLUENT_SECURITY_PROTOCOL:SASL_SSL}" |
139 | + consumerPropertiesPerTopic: | |
140 | + tb_firmware: | |
141 | + - key: max.poll.records | |
142 | + value: 10 | |
139 | 143 | other: |
140 | 144 | topic-properties: |
141 | 145 | rule-engine: "${TB_QUEUE_KAFKA_RE_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:26214400;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" | ... | ... |