func main() {
app := boost.New()
kafkaConfig := configurator.
New().
SetConsumer().
SetProducer().
SetHosts(config.Get("KAFKA_HOSTS").Strings()).
SetAuth(config.Get("KAFKA_USER").String(), config.Get("KAFKA_PASS").String()).
SetMechanism(mechanisms.Plain)
// consumer example
err := consumer.
New("c360_valid_attrs", kafkaConfig).
StartConsume(func(message *sarama.ConsumerMessage) error {
fmt.Printf("Message value: %s\n", message.Value)
return nil
})
if err != nil {
log.Fatal(err)
}
// producer example
prod, err := producer.NewSync(kafkaConfig)
if err != nil {
log.Fatal("Create producer error: ", err)
}
prod.Publish("c360_valid_attrs", "123", "")
app.Run()
}
-
Notifications
You must be signed in to change notification settings - Fork 0
lowl11/boost2
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published