Search in sources :

Example 1 with TopicConfigException

use of org.zalando.nakadi.exceptions.runtime.TopicConfigException in project nakadi by zalando.

the class KafkaTopicRepository method setRetentionTime.

@Override
public void setRetentionTime(final String topic, final Long retentionMs) throws TopicConfigException {
    try {
        doWithZkUtils(zkUtils -> {
            final Properties topicProps = AdminUtils.fetchEntityConfig(zkUtils, ConfigType.Topic(), topic);
            topicProps.setProperty("retention.ms", Long.toString(retentionMs));
            AdminUtils.changeTopicConfig(zkUtils, topic, topicProps);
        });
    } catch (final Exception e) {
        throw new TopicConfigException("Unable to update retention time for topic " + topic, e);
    }
}
Also used : TopicConfigException(org.zalando.nakadi.exceptions.runtime.TopicConfigException) Properties(java.util.Properties) EventPublishingException(org.zalando.nakadi.exceptions.EventPublishingException) NotLeaderForPartitionException(org.apache.kafka.common.errors.NotLeaderForPartitionException) TimeoutException(java.util.concurrent.TimeoutException) TopicRepositoryException(org.zalando.nakadi.exceptions.runtime.TopicRepositoryException) ServiceUnavailableException(org.zalando.nakadi.exceptions.ServiceUnavailableException) InvalidCursorException(org.zalando.nakadi.exceptions.InvalidCursorException) TopicDeletionException(org.zalando.nakadi.exceptions.TopicDeletionException) TopicExistsException(org.apache.kafka.common.errors.TopicExistsException) UnknownTopicOrPartitionException(org.apache.kafka.common.errors.UnknownTopicOrPartitionException) NetworkException(org.apache.kafka.common.errors.NetworkException) TopicCreationException(org.zalando.nakadi.exceptions.TopicCreationException) TopicConfigException(org.zalando.nakadi.exceptions.runtime.TopicConfigException) UnknownServerException(org.apache.kafka.common.errors.UnknownServerException) InterruptException(org.apache.kafka.common.errors.InterruptException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

Properties (java.util.Properties)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 InterruptException (org.apache.kafka.common.errors.InterruptException)1 NetworkException (org.apache.kafka.common.errors.NetworkException)1 NotLeaderForPartitionException (org.apache.kafka.common.errors.NotLeaderForPartitionException)1 TopicExistsException (org.apache.kafka.common.errors.TopicExistsException)1 UnknownServerException (org.apache.kafka.common.errors.UnknownServerException)1 UnknownTopicOrPartitionException (org.apache.kafka.common.errors.UnknownTopicOrPartitionException)1 EventPublishingException (org.zalando.nakadi.exceptions.EventPublishingException)1 InvalidCursorException (org.zalando.nakadi.exceptions.InvalidCursorException)1 ServiceUnavailableException (org.zalando.nakadi.exceptions.ServiceUnavailableException)1 TopicCreationException (org.zalando.nakadi.exceptions.TopicCreationException)1 TopicDeletionException (org.zalando.nakadi.exceptions.TopicDeletionException)1 TopicConfigException (org.zalando.nakadi.exceptions.runtime.TopicConfigException)1 TopicRepositoryException (org.zalando.nakadi.exceptions.runtime.TopicRepositoryException)1