use of org.zalando.nakadi.repository.kafka.KafkaFactory in project nakadi by zalando.
the class KafkaRepositoryCreator method createTopicRepository.
@Override
public TopicRepository createTopicRepository(final Storage storage) throws TopicRepositoryException {
try {
final Storage.KafkaConfiguration kafkaConfiguration = storage.getKafkaConfiguration();
final ZooKeeperHolder zooKeeperHolder = new ZooKeeperHolder(kafkaConfiguration.getZkAddress(), kafkaConfiguration.getZkPath(), kafkaConfiguration.getExhibitorAddress(), kafkaConfiguration.getExhibitorPort());
final KafkaFactory kafkaFactory = new KafkaFactory(new KafkaLocationManager(zooKeeperHolder, kafkaSettings), metricRegistry);
final KafkaTopicRepository kafkaTopicRepository = new KafkaTopicRepository(zooKeeperHolder, kafkaFactory, nakadiSettings, kafkaSettings, zookeeperSettings, uuidGenerator);
// check that it does work
kafkaTopicRepository.listTopics();
return kafkaTopicRepository;
} catch (final Exception e) {
throw new TopicRepositoryException("Could not create topic repository", e);
}
}
Aggregations