sjvanrossum commented on code in PR #26948:
URL: https://github.com/apache/beam/pull/26948#discussion_r1246605302
##########
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:
`Read.External.Configuration` has fields for `keyDeserializer` and
`valueDeserializer` which are resolved from `String` to `Class` during external
transform construction, does it make sense to provide a mapping there instead?
--
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]