Skip to content

Commit

Permalink
starting kafka config once
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Dec 13, 2023
1 parent 2c21603 commit 62a731d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/event_listener/event_listener_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ type IncomingMessage struct {
} `json:"diff"`
}

var kafkaConfig = &consumer.KafkaConfiguration{
Brokers: config.NewString("event-listener-brokers", "localhost:9092", "Kafka brokers"),
SecurityProtocol: config.NewString("event-listener-security-protocol", "plaintext", "Kafka security protocol"),
AuthenticationMechanism: config.NewString("event-listener-authentication-mechanism", "none", "Kafka authentication mechanism"),
}

type EventListener struct {
settings port.EventListenerSettings
stateKey string
Expand Down Expand Up @@ -64,9 +70,9 @@ func startKafkaEventListener(l *EventListener, resync func()) error {
}

c := &consumer.KafkaConfiguration{
Brokers: config.NewString("event-listener-brokers", "localhost:9092", "Kafka brokers"),
SecurityProtocol: config.NewString("event-listener-security-protocol", "plaintext", "Kafka security protocol"),
AuthenticationMechanism: config.NewString("event-listener-authentication-mechanism", "none", "Kafka authentication mechanism"),
Brokers: kafkaConfig.Brokers,
SecurityProtocol: kafkaConfig.SecurityProtocol,
AuthenticationMechanism: kafkaConfig.AuthenticationMechanism,
Username: credentials.Username,
Password: credentials.Password,
GroupID: orgId + ".k8s." + l.stateKey,
Expand Down

0 comments on commit 62a731d

Please sign in to comment.