You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by hmcl <gi...@git.apache.org> on 2017/01/03 21:38:44 UTC

[GitHub] storm pull request #1835: STORM-2236: Kafka Spout with manual partition mana...

Github user hmcl commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1835#discussion_r93558408
  
    --- Diff: external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/internal/partition/KafkaPartitionReaders.java ---
    @@ -0,0 +1,27 @@
    +package org.apache.storm.kafka.spout.internal.partition;
    +
    +import org.apache.kafka.common.PartitionInfo;
    +import org.apache.kafka.common.TopicPartition;
    +import org.apache.storm.kafka.spout.KafkaSpoutStreams;
    +import org.apache.storm.kafka.spout.KafkaSpoutStreamsNamedTopics;
    +import org.apache.storm.kafka.spout.KafkaSpoutStreamsWildcardTopics;
    +
    +import java.util.HashSet;
    +
    +public final class KafkaPartitionReaders {
    +    public static KafkaPartitionReader partitionReaderOf(KafkaSpoutStreams kafkaSpoutStreams) {
    +        if (kafkaSpoutStreams instanceof KafkaSpoutStreamsNamedTopics) {
    +            return new NamedTopicPartitionReader(new HashSet<>(
    +                KafkaSpoutStreamsNamedTopics.class.cast(kafkaSpoutStreams).getTopics()));
    +        } else if (kafkaSpoutStreams instanceof KafkaSpoutStreamsWildcardTopics) {
    +            return new WildcardTopicPartitionReader(
    +                KafkaSpoutStreamsWildcardTopics.class.cast(kafkaSpoutStreams).getTopicWildcardPattern());
    +        } else {
    +            throw new IllegalArgumentException("Unrecognized kafka spout stream: " + kafkaSpoutStreams.getClass());
    +        }
    +    }
    +
    +    public static TopicPartition convert(PartitionInfo partitionInfo) {
    --- End diff --
    
    call this toTopicPartition


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---