@@ -119,6 +119,14 @@ pub struct Cli {
119
119
pub trino_auth : Option < String > ,
120
120
pub trino_schema : Option < String > ,
121
121
pub trino_catalog : Option < String > ,
122
+
123
+ // Kafka specific env vars
124
+ pub kafka_topic : Option < String > ,
125
+ pub kafka_host : Option < String > ,
126
+ pub kafka_group : Option < String > ,
127
+ pub kafka_client_id : Option < String > ,
128
+ pub kafka_security_protocol : Option < String > ,
129
+ pub kafka_partitions : Option < String > ,
122
130
}
123
131
124
132
impl Cli {
@@ -164,6 +172,14 @@ impl Cli {
164
172
pub const TRINO_AUTHORIZATION : & ' static str = "p-trino-authorization" ;
165
173
pub const TRINO_SCHEMA : & ' static str = "p-trino-schema" ;
166
174
175
+ // Kafka specific env vars
176
+ pub const KAFKA_TOPIC : & ' static str = "kafka-topic" ;
177
+ pub const KAFKA_HOST : & ' static str = "kafka-host" ;
178
+ pub const KAFKA_GROUP : & ' static str = "kafka-group" ;
179
+ pub const KAFKA_CLIENT_ID : & ' static str = "kafka-client-id" ;
180
+ pub const KAFKA_SECURITY_PROTOCOL : & ' static str = "kafka-security-protocol" ;
181
+ pub const KAFKA_PARTITIONS : & ' static str = "kafka-partitions" ;
182
+
167
183
pub fn local_stream_data_path ( & self , stream_name : & str ) -> PathBuf {
168
184
self . local_staging_path . join ( stream_name)
169
185
}
@@ -177,6 +193,48 @@ impl Cli {
177
193
178
194
pub fn create_cli_command_with_clap ( name : & ' static str ) -> Command {
179
195
Command :: new ( name) . next_line_help ( false )
196
+ . arg (
197
+ Arg :: new ( Self :: KAFKA_TOPIC )
198
+ . long ( Self :: KAFKA_TOPIC )
199
+ . env ( "P_KAFKA_TOPIC" )
200
+ . value_name ( "STRING" )
201
+ . help ( "Kafka topic to subscribe to" ) ,
202
+ )
203
+ . arg (
204
+ Arg :: new ( Self :: KAFKA_HOST )
205
+ . long ( Self :: KAFKA_HOST )
206
+ . env ( "P_KAFKA_HOST" )
207
+ . value_name ( "STRING" )
208
+ . help ( "Address and port for Kafka server" ) ,
209
+ )
210
+ . arg (
211
+ Arg :: new ( Self :: KAFKA_GROUP )
212
+ . long ( Self :: KAFKA_GROUP )
213
+ . env ( "P_KAFKA_GROUP" )
214
+ . value_name ( "STRING" )
215
+ . help ( "Kafka group" ) ,
216
+ )
217
+ . arg (
218
+ Arg :: new ( Self :: KAFKA_CLIENT_ID )
219
+ . long ( Self :: KAFKA_CLIENT_ID )
220
+ . env ( "P_KAFKA_CLIENT_ID" )
221
+ . value_name ( "STRING" )
222
+ . help ( "Kafka client id" ) ,
223
+ )
224
+ . arg (
225
+ Arg :: new ( Self :: KAFKA_SECURITY_PROTOCOL )
226
+ . long ( Self :: KAFKA_SECURITY_PROTOCOL )
227
+ . env ( "P_KAFKA_SECURITY_PROTOCOL" )
228
+ . value_name ( "STRING" )
229
+ . help ( "Kafka security protocol (ssl)" ) ,
230
+ )
231
+ . arg (
232
+ Arg :: new ( Self :: KAFKA_PARTITIONS )
233
+ . long ( Self :: KAFKA_PARTITIONS )
234
+ . env ( "P_KAFKA_PARTITIONS" )
235
+ . value_name ( "STRING" )
236
+ . help ( "Kafka partitions" ) ,
237
+ )
180
238
. arg (
181
239
Arg :: new ( Self :: TRINO_ENDPOINT )
182
240
. long ( Self :: TRINO_ENDPOINT )
@@ -520,6 +578,13 @@ impl FromArgMatches for Cli {
520
578
self . trino_schema = m. get_one :: < String > ( Self :: TRINO_SCHEMA ) . cloned ( ) ;
521
579
self . trino_username = m. get_one :: < String > ( Self :: TRINO_USER_NAME ) . cloned ( ) ;
522
580
581
+ self . kafka_topic = m. get_one :: < String > ( Self :: KAFKA_TOPIC ) . cloned ( ) ;
582
+ self . kafka_host = m. get_one :: < String > ( Self :: KAFKA_HOST ) . cloned ( ) ;
583
+ self . kafka_group = m. get_one :: < String > ( Self :: KAFKA_GROUP ) . cloned ( ) ;
584
+ self . kafka_client_id = m. get_one :: < String > ( Self :: KAFKA_CLIENT_ID ) . cloned ( ) ;
585
+ self . kafka_security_protocol = m. get_one :: < String > ( Self :: KAFKA_SECURITY_PROTOCOL ) . cloned ( ) ;
586
+ self . kafka_partitions = m. get_one :: < String > ( Self :: KAFKA_PARTITIONS ) . cloned ( ) ;
587
+
523
588
self . local_cache_path = m. get_one :: < PathBuf > ( Self :: CACHE ) . cloned ( ) ;
524
589
self . query_cache_path = m. get_one :: < PathBuf > ( Self :: QUERY_CACHE ) . cloned ( ) ;
525
590
self . tls_cert_path = m. get_one :: < PathBuf > ( Self :: TLS_CERT ) . cloned ( ) ;
0 commit comments