2024-07-27 17:00:47 +05:30
|
|
|
package kafka
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"cybertron/configs"
|
2024-07-29 15:46:17 +05:30
|
|
|
"github.com/confluentinc/confluent-kafka-go/v2/kafka"
|
2024-07-27 17:00:47 +05:30
|
|
|
)
|
|
|
|
|
|
2024-07-29 15:46:17 +05:30
|
|
|
func ConfluentProducer(baseConfig *configs.KafkaConfig) (*kafka.Producer, error) {
|
|
|
|
|
return kafka.NewProducer(&kafka.ConfigMap{
|
|
|
|
|
"bootstrap.servers": baseConfig.Brokers[0],
|
|
|
|
|
"security.protocol": "SASL_SSL",
|
|
|
|
|
"sasl.mechanisms": "PLAIN",
|
|
|
|
|
"sasl.username": baseConfig.Username,
|
|
|
|
|
"sasl.password": baseConfig.Password,
|
|
|
|
|
})
|
2024-07-27 17:00:47 +05:30
|
|
|
}
|