Skip to content

Commit 768c046

Browse files
author
ffffwh
committed
kafka: add User and Password #968
1 parent ab25514 commit 768c046

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

driver/common/taskconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ type KafkaConfig struct {
142142
Topic string
143143
Converter string
144144
TimeZone string
145+
User string
146+
Password string
145147
MessageGroupMaxSize uint64
146148
MessageGroupTimeout uint64
147149

driver/driver.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var (
8282
hclspec.NewLiteral(`""`)),
8383
"memory": hclspec.NewAttr("memory", "string", false),
8484
"big_tx_max_jobs": hclspec.NewAttr("big_tx_max_jobs", "number", false),
85-
"log_file": hclspec.NewDefault(hclspec.NewAttr("log_file", "string", false),
85+
"log_file": hclspec.NewDefault(hclspec.NewAttr("log_file", "string", false),
8686
hclspec.NewLiteral(`"/var/log/dtle"`)),
8787
})
8888

@@ -164,6 +164,8 @@ var (
164164
"TopicWithSchemaTable": hclspec.NewDefault(hclspec.NewAttr("TopicWithSchemaTable", "bool", false),
165165
hclspec.NewLiteral(`true`)),
166166
"SchemaChangeTopic": hclspec.NewAttr("SchemaChangeTopic", "string", false),
167+
"User": hclspec.NewAttr("User", "string", false),
168+
"Password": hclspec.NewAttr("SchemaChangeTopic", "string", false),
167169
})),
168170
// Since each job has its own history, this should be smaller than MySQL default (25000).
169171
"DependencyHistorySize": hclspec.NewDefault(hclspec.NewAttr("DependencyHistorySize", "number", false),
@@ -229,8 +231,8 @@ type Driver struct {
229231
// logger will log to the Nomad agent
230232
logger g.LoggerType
231233

232-
stand *stand.StanServer
233-
apiServer *httprouter.Router
234+
stand *stand.StanServer
235+
apiServer *httprouter.Router
234236
setupApiServerFn func(logger g.LoggerType, driverConfig *DriverConfig) error
235237

236238
config *DriverConfig

driver/kafka/kafka2.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func NewKafkaManager(kcfg *common.KafkaConfig) (*KafkaManager, error) {
7171
}
7272
config := sarama.NewConfig()
7373
config.Producer.Return.Successes = true
74+
config.Net.SASL.User = kcfg.User
75+
config.Net.SASL.Password = kcfg.Password
7476

7577
k.producer, err = sarama.NewSyncProducer(kcfg.Brokers, config)
7678
if err != nil {

0 commit comments

Comments
 (0)