chamikaramj commented on code in PR #26948:
URL: https://github.com/apache/beam/pull/26948#discussion_r1245239927


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java:
##########
@@ -936,11 +944,26 @@ public Read<K, V> withTopics(List<String> topics) {
      */
     public Read<K, V> withTopicPartitions(List<TopicPartition> 
topicPartitions) {
       checkState(
-          getTopics() == null || getTopics().isEmpty(),
-          "Only topics or topicPartitions can be set, not both");
+          (getTopics() == null || getTopics().isEmpty()) && getTopicPattern() 
== null,
+          "Only one of topics, topicPartitions or topicPattern can be set");
       return 
toBuilder().setTopicPartitions(ImmutableList.copyOf(topicPartitions)).build();
     }
 
+    /**
+     * Sets a {@link java.util.regex.Pattern} of topics to read from. All the 
partitions from each
+     * of the matching topics are read.
+     *
+     * <p>See {@link KafkaUnboundedSource#split(int, PipelineOptions)} for 
description of how the
+     * partitions are distributed among the splits.
+     */
+    public Read<K, V> withTopicPattern(Pattern topicPattern) {

Review Comment:
   Can change this API to use a portable type (for example, a string regex) so 
that this can be supported via cross-language wrappers ?
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to