Search in sources :

Example 1 with KafkaFactory

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);
    }
}
Also used : KafkaFactory(org.zalando.nakadi.repository.kafka.KafkaFactory) Storage(org.zalando.nakadi.domain.Storage) KafkaTopicRepository(org.zalando.nakadi.repository.kafka.KafkaTopicRepository) KafkaLocationManager(org.zalando.nakadi.repository.kafka.KafkaLocationManager) ZooKeeperHolder(org.zalando.nakadi.repository.zookeeper.ZooKeeperHolder) NakadiRuntimeException(org.zalando.nakadi.exceptions.NakadiRuntimeException) TopicRepositoryException(org.zalando.nakadi.exceptions.runtime.TopicRepositoryException) TopicRepositoryException(org.zalando.nakadi.exceptions.runtime.TopicRepositoryException)

Aggregations

Storage (org.zalando.nakadi.domain.Storage)1 NakadiRuntimeException (org.zalando.nakadi.exceptions.NakadiRuntimeException)1 TopicRepositoryException (org.zalando.nakadi.exceptions.runtime.TopicRepositoryException)1 KafkaFactory (org.zalando.nakadi.repository.kafka.KafkaFactory)1 KafkaLocationManager (org.zalando.nakadi.repository.kafka.KafkaLocationManager)1 KafkaTopicRepository (org.zalando.nakadi.repository.kafka.KafkaTopicRepository)1 ZooKeeperHolder (org.zalando.nakadi.repository.zookeeper.ZooKeeperHolder)1