Exemplo n.º 1
0
func startNewConsumer(config kafkaClient.ConsumerConfig, topic string) *kafkaClient.Consumer {
	config.Strategy = GetStrategy(config.Consumerid)
	config.WorkerFailureCallback = FailedCallback
	config.WorkerFailedAttemptCallback = FailedAttemptCallback
	consumer := kafkaClient.NewConsumer(&config)
	topics := map[string]int{topic: config.NumConsumerFetchers}
	go func() {
		consumer.StartStatic(topics)
	}()
	return consumer
}
Exemplo n.º 2
0
func setupLogLineProtoConfig(config *kafka.ConsumerConfig) {
	config.Strategy = logLineProtoStrategy
}
Exemplo n.º 3
0
func setupAvroConfig(config *kafka.ConsumerConfig) {
	config.ValueDecoder = kafka.NewKafkaAvroDecoder(*schemaRegistry)
	config.Strategy = avroStrategy
}