Java Code Examples for org.apache.kafka.common.internals.Topic#validate()
The following examples show how to use
org.apache.kafka.common.internals.Topic#validate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KafkaValidator.java From ditto with Eclipse Public License 2.0 | 6 votes |
private static void validateTopic(final String topic, final DittoHeaders dittoHeaders, final String placeholderReplacement) { if (topic.isEmpty()) { throwEmptyException("topic", dittoHeaders); } try { final String topicWithoutPlaceholders = topic.replaceAll(Pattern.quote(placeholderReplacement), DUMMY_TOPIC); Topic.validate(topicWithoutPlaceholders); } catch (final InvalidTopicException e) { final String message = MessageFormat.format(INVALID_TOPIC_FORMAT, topic, e.getMessage()); throw ConnectionConfigurationInvalidException.newBuilder(message) .dittoHeaders(dittoHeaders) .cause(e) .build(); } }
Example 2
Source File: KafkaPublishTarget.java From ditto with Eclipse Public License 2.0 | 5 votes |
private static String validateTopic(final String topic) { try { Topic.validate(topic); return topic; } catch (final InvalidTopicException e) { throw ConnectionConfigurationInvalidException.newBuilder(e.getMessage()) .cause(e) .build(); } }
Example 3
Source File: TopicName.java From strimzi-kafka-operator with Apache License 2.0 | 5 votes |
public TopicName(String name) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException(); } // TODO Shame we can't validate a topic name without relying on an internal class Topic.validate(name); this.name = name; }