@@ -32,12 +32,38 @@ import (
3232const profileAddress = "127.0.0.1:6060"
3333
3434type options struct {
35+ // Common options shared across Kafka, Pulsar, and Storage sources.
3536 upstreamURI string
3637 downstreamURI string
3738 configFile string
3839 consumerID string
3940 logFile string
41+ logLevel string
42+ timezone string
4043 enableProfiling bool
44+
45+ // Kafka options for consumer group, Avro/Debezium schema lookup, and upstream row lookup.
46+ consumerGroupID string
47+ schemaRegistryURI string
48+ upstreamTiDBDSN string
49+
50+ // Transport TLS options shared by Kafka and Pulsar sources.
51+ ca string
52+ cert string
53+ key string
54+
55+ // Pulsar authentication options for mTLS and OAuth2 connections.
56+ authTLSCertificatePath string
57+ authTLSPrivateKeyPath string
58+ oauth2PrivateKey string
59+ oauth2IssuerURL string
60+ oauth2ClientID string
61+ oauth2Scope string
62+ oauth2Audience string
63+
64+ // Storage options for cloud storage scan cadence and DML file naming.
65+ flushInterval time.Duration
66+ fileIndexWidth int
4167}
4268
4369func main () {
@@ -91,13 +117,46 @@ func newCommand() *cobra.Command {
91117 })
92118
93119 flags := command .Flags ()
120+
121+ // Common options (Kafka, Pulsar, and Storage).
94122 flags .StringVar (& options .upstreamURI , "upstream-uri" , "" , "Kafka, Pulsar, or Storage source URI" )
95123 flags .StringVar (& options .downstreamURI , "downstream-uri" , "" , "downstream sink URI" )
96124 flags .StringVar (& options .configFile , "config" , "" , "consumer configuration file" )
97125 flags .StringVar (& options .consumerID , "consumer-id" , "" ,
98126 "Kafka group ID or Pulsar subscription name (random if omitted)" )
99127 flags .StringVar (& options .logFile , "log-file" , "cdc_consumer.log" , "log file path" )
128+ flags .StringVar (& options .logLevel , "log-level" , "info" , "log level" )
129+ flags .StringVar (& options .timezone , "tz" , "System" , "consumer time zone" )
100130 flags .BoolVar (& options .enableProfiling , "enable-profiling" , false , "enable pprof on " + profileAddress )
101131
132+ // Kafka options (consumer group, Avro schema registry, and handle-key-only / claim-check upstream lookup).
133+ flags .StringVar (& options .consumerGroupID , "consumer-group-id" , "" ,
134+ "Kafka consumer group ID (alias for --consumer-id)" )
135+ flags .StringVar (& options .schemaRegistryURI , "schema-registry-uri" , "" ,
136+ "Kafka Avro/Debezium-Avro schema registry URI" )
137+ flags .StringVar (& options .upstreamTiDBDSN , "upstream-tidb-dsn" , "" ,
138+ "upstream TiDB DSN for Kafka handle-key-only, simple, and claim-check lookup" )
139+
140+ // Kafka and Pulsar TLS transport options.
141+ flags .StringVar (& options .ca , "ca" , "" , "CA certificate path for Kafka/Pulsar TLS" )
142+ flags .StringVar (& options .cert , "cert" , "" , "client certificate path for Kafka/Pulsar TLS" )
143+ flags .StringVar (& options .key , "key" , "" , "client private key path for Kafka/Pulsar TLS" )
144+
145+ // Pulsar authentication options (mTLS and OAuth2).
146+ flags .StringVar (& options .authTLSCertificatePath , "auth-tls-certificate-path" , "" ,
147+ "Pulsar mTLS authentication certificate path" )
148+ flags .StringVar (& options .authTLSPrivateKeyPath , "auth-tls-private-key-path" , "" ,
149+ "Pulsar mTLS authentication private key path" )
150+ flags .StringVar (& options .oauth2PrivateKey , "oauth2-private-key" , "" , "Pulsar OAuth2 private key path" )
151+ flags .StringVar (& options .oauth2IssuerURL , "oauth2-issuer-url" , "" , "Pulsar OAuth2 issuer URL" )
152+ flags .StringVar (& options .oauth2ClientID , "oauth2-client-id" , "" , "Pulsar OAuth2 client ID" )
153+ flags .StringVar (& options .oauth2Scope , "oauth2-scope" , "" , "Pulsar OAuth2 scope" )
154+ flags .StringVar (& options .oauth2Audience , "oauth2-audience" , "" , "Pulsar OAuth2 audience" )
155+
156+ // Storage options (scan interval and DML file index formatting).
157+ flags .DurationVar (& options .flushInterval , "flush-interval" , 2 * time .Second , "storage scan interval" )
158+ flags .IntVar (& options .fileIndexWidth , "file-index-width" , 0 ,
159+ "storage file index width (uses config or default if unset)" )
160+
102161 return command
103162}
0 commit comments