예제 #1
0
func NewKafkaConsumer() (*IndeedKafkaConsumer, error) {
	consumer, partitionConsumers, err := eatonconsumer.NewSaramaConsumers(eatonconfig.KafkaServers, eatonconfig.KafkaTopic, eatonconfig.OffsetType)
	if err != nil {
		return nil, err
	}
	return &IndeedKafkaConsumer{
		consumer:           *consumer,
		partitionConsumers: *partitionConsumers,
	}, nil
}
예제 #2
0
func NewEventConsumer() (*EventConsumer, error) {
	consumer, partitionConsumers, err := eatonconsumer.NewSaramaConsumers(eatonconfig.KafkaServers, eatonconfig.KafkaLoggerTopic, eatonconfig.OffsetType)
	if err != nil {
		return nil, err
	}
	return &EventConsumer{
		consumer:           *consumer,
		partitionConsumers: *partitionConsumers,
	}, nil
}