|
10 | 10 | #include <userver/storages/secdist/component.hpp> |
11 | 11 | #include <userver/yaml_config/merge_schemas.hpp> |
12 | 12 |
|
| 13 | +#ifndef ARCADIA_ROOT |
| 14 | +#include "generated/src/kafka/consumer_component.yaml.hpp" // Y_IGNORE |
| 15 | +#endif |
| 16 | + |
13 | 17 | USERVER_NAMESPACE_BEGIN |
14 | 18 |
|
15 | 19 | namespace kafka { |
@@ -61,150 +65,7 @@ ConsumerComponent::~ConsumerComponent() { statistics_holder_.Unregister(); } |
61 | 65 | ConsumerScope ConsumerComponent::GetConsumer() { return consumer_->MakeConsumerScope(); } |
62 | 66 |
|
63 | 67 | yaml_config::Schema ConsumerComponent::GetStaticConfigSchema() { |
64 | | - return yaml_config::MergeSchemas<components::ComponentBase>(R"( |
65 | | -type: object |
66 | | -description: Kafka consumer component |
67 | | -additionalProperties: false |
68 | | -properties: |
69 | | - group_id: |
70 | | - type: string |
71 | | - description: | |
72 | | - consumer group id. |
73 | | - Topic partition evenly distributed |
74 | | - between consumers with the same `group_id` |
75 | | - client_id: |
76 | | - type: string |
77 | | - description: | |
78 | | - Client identifier. |
79 | | - May be an arbitrary string. |
80 | | - Optional, but you should set this property on each instance |
81 | | - because it enables you to more easily correlate requests on the broker |
82 | | - with the client instance which made it, |
83 | | - which can be helpful in debugging and troubleshooting scenarios. |
84 | | - defaultDescription: userver |
85 | | - topics: |
86 | | - type: array |
87 | | - description: list of topics consumer subscribes |
88 | | - items: |
89 | | - type: string |
90 | | - description: topic name |
91 | | - max_batch_size: |
92 | | - type: integer |
93 | | - description: maximum number of messages consumer waits for new messages before calling a callback |
94 | | - defaultDescription: 1 |
95 | | - poll_timeout: |
96 | | - type: string |
97 | | - description: maximum amount of time consumer waits for new messages before calling a callback |
98 | | - defaultDescription: 1s |
99 | | - message_key_log_format: |
100 | | - type: string |
101 | | - enum: |
102 | | - - plaintext |
103 | | - - hex |
104 | | - description: | |
105 | | - Specifies the logging format for the message key. |
106 | | - - 'plaintext': logs the message key as-is. |
107 | | - - 'hex': logs the message key in hexadecimal format. |
108 | | - defaultDescription: plaintext |
109 | | - max_callback_duration: |
110 | | - type: string |
111 | | - description: | |
112 | | - duration user callback must fit not to be kicked from the consumer group. |
113 | | - The duration must fit in [1ms; 86400000ms] |
114 | | - defaultDescription: 5m |
115 | | - restart_after_failure_delay: |
116 | | - type: string |
117 | | - description: backoff consumer waits until restart after user-callback exception. |
118 | | - defaultDescription: 10s |
119 | | - auto_offset_reset: |
120 | | - type: string |
121 | | - description: | |
122 | | - action to take when there is no |
123 | | - initial offset in offset store |
124 | | - or the desired offset is out of range: |
125 | | - `smallest`, `earliest`, `beginning` - automatically reset |
126 | | - the offset to the smallest offset |
127 | | - `largest`, `latest`, `end` - automatically reset |
128 | | - the offset to the largest offset, |
129 | | - `error` - trigger an error (ERR__AUTO_OFFSET_RESET). |
130 | | - Note: the policy applies iff there are not committed |
131 | | - offsets in topic |
132 | | - enum: |
133 | | - - smallest |
134 | | - - earliest |
135 | | - - beginning |
136 | | - - largest |
137 | | - - latest |
138 | | - - end |
139 | | - - error |
140 | | - env_pod_name: |
141 | | - type: string |
142 | | - description: | |
143 | | - if defined and `group_id` value contains |
144 | | - `{pod_name}` substring, the substring |
145 | | - is replaced with the value of the environment |
146 | | - variable `env_pod_name` |
147 | | - defaultDescription: none |
148 | | - security_protocol: |
149 | | - type: string |
150 | | - description: protocol used to communicate with brokers |
151 | | - enum: |
152 | | - - PLAINTEXT |
153 | | - - SASL_SSL |
154 | | - - SASL_PLAINTEXT |
155 | | - - SSL |
156 | | - sasl_mechanisms: |
157 | | - type: string |
158 | | - description: | |
159 | | - SASL mechanism to use for authentication. |
160 | | - Must be set if `security_protocol` equals `SASL_SSL` |
161 | | - defaultDescription: none |
162 | | - enum: |
163 | | - - PLAIN |
164 | | - - SCRAM-SHA-512 |
165 | | - ssl_ca_location: |
166 | | - type: string |
167 | | - description: | |
168 | | - file or directory path to CA certificate(s) for verifying the broker's key. |
169 | | - Must be set if `security_protocol` equals `SASL_SSL` or `SSL`. |
170 | | - If set to `probe`, CA certificates are probed from the default certificates paths |
171 | | - defaultDescription: none |
172 | | - topic_metadata_refresh_interval: |
173 | | - type: string |
174 | | - description: | |
175 | | - period of time at which |
176 | | - topic and broker metadata is refreshed |
177 | | - in order to discover any new brokers, |
178 | | - topics, partitions or partition leader changes |
179 | | - defaultDescription: 5m |
180 | | - metadata_max_age: |
181 | | - type: string |
182 | | - description: | |
183 | | - metadata cache max age. |
184 | | - Recommended value is 3 times `topic_metadata_refresh_interval` |
185 | | - defaultDescription: 15m |
186 | | - rd_kafka_custom_options: |
187 | | - type: object |
188 | | - description: | |
189 | | - a map of arbitrary `librdkafka` library configuration options. |
190 | | - Full list of options is available by link: https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md. |
191 | | - Note: This options is not guaranteed to be supported in userver-kafka, use it at your own risk |
192 | | - properties: {} |
193 | | - additionalProperties: |
194 | | - type: string |
195 | | - description: librdkafka option value |
196 | | - defaultDescription: '{}' |
197 | | - debug_info_log_level: |
198 | | - type: string |
199 | | - description: | |
200 | | - log level for everything debug information |
201 | | - defaultDescription: debug |
202 | | - operation_log_level: |
203 | | - type: string |
204 | | - description: | |
205 | | - log level for infos about ordinary actions |
206 | | - defaultDescription: debug |
207 | | -)"); |
| 68 | + return yaml_config::MergeSchemasFromResource<components::ComponentBase>("src/kafka/consumer_component.yaml"); |
208 | 69 | } |
209 | 70 |
|
210 | 71 | } // namespace kafka |
|
0 commit comments