sjvanrossum commented on code in PR #26948:
URL: https://github.com/apache/beam/pull/26948#discussion_r1246950699
##########
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:
Mostly to make sure that pattern flags can be specified by users, but nearly
all (except `LITERAL` and `CANON_EQ`) can be specified in the expression as
well.
--
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]