|
112 | 112 | import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList; |
113 | 113 | import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap; |
114 | 114 | import org.apache.kafka.clients.CommonClientConfigs; |
115 | | -import org.apache.kafka.clients.admin.Admin; |
116 | 115 | import org.apache.kafka.clients.consumer.Consumer; |
117 | 116 | import org.apache.kafka.clients.consumer.ConsumerConfig; |
118 | 117 | import org.apache.kafka.clients.consumer.KafkaConsumer; |
@@ -603,7 +602,6 @@ public static <K, V> Read<K, V> read() { |
603 | 602 | return new AutoValue_KafkaIO_Read.Builder<K, V>() |
604 | 603 | .setTopics(new ArrayList<>()) |
605 | 604 | .setTopicPartitions(new ArrayList<>()) |
606 | | - .setAdminFactoryFn(KafkaIOUtils.KAFKA_ADMIN_FACTORY_FN) |
607 | 605 | .setConsumerFactoryFn(KafkaIOUtils.KAFKA_CONSUMER_FACTORY_FN) |
608 | 606 | .setConsumerConfig(KafkaIOUtils.DEFAULT_CONSUMER_PROPERTIES) |
609 | 607 | .setMaxNumRecords(Long.MAX_VALUE) |
@@ -695,9 +693,6 @@ public abstract static class Read<K, V> |
695 | 693 | @Pure |
696 | 694 | public abstract @Nullable Coder<V> getValueCoder(); |
697 | 695 |
|
698 | | - @Pure |
699 | | - public abstract SerializableFunction<Map<String, Object>, Admin> getAdminFactoryFn(); |
700 | | - |
701 | 696 | @Pure |
702 | 697 | public abstract SerializableFunction<Map<String, Object>, Consumer<byte[], byte[]>> |
703 | 698 | getConsumerFactoryFn(); |
@@ -781,9 +776,6 @@ abstract static class Builder<K, V> { |
781 | 776 |
|
782 | 777 | abstract Builder<K, V> setValueCoder(Coder<V> valueCoder); |
783 | 778 |
|
784 | | - abstract Builder<K, V> setAdminFactoryFn( |
785 | | - SerializableFunction<Map<String, Object>, Admin> adminFactoryFn); |
786 | | - |
787 | 779 | abstract Builder<K, V> setConsumerFactoryFn( |
788 | 780 | SerializableFunction<Map<String, Object>, Consumer<byte[], byte[]>> consumerFactoryFn); |
789 | 781 |
|
@@ -867,7 +859,6 @@ static <K, V> void setupExternalBuilder( |
867 | 859 |
|
868 | 860 | // Set required defaults |
869 | 861 | builder.setTopicPartitions(Collections.emptyList()); |
870 | | - builder.setAdminFactoryFn(KafkaIOUtils.KAFKA_ADMIN_FACTORY_FN); |
871 | 862 | builder.setConsumerFactoryFn(KafkaIOUtils.KAFKA_CONSUMER_FACTORY_FN); |
872 | 863 | if (config.maxReadTime != null) { |
873 | 864 | builder.setMaxReadTime(Duration.standardSeconds(config.maxReadTime)); |
@@ -1275,15 +1266,6 @@ public Read<K, V> withValueDeserializerProviderAndCoder( |
1275 | 1266 | .build(); |
1276 | 1267 | } |
1277 | 1268 |
|
1278 | | - /** |
1279 | | - * A factory to create Kafka {@link Admin} from offset consumer configuration. This is useful |
1280 | | - * for supporting another version of Kafka admin. Default is {@link Admin#create(Map)}. |
1281 | | - */ |
1282 | | - public Read<K, V> withAdminFactoryFn( |
1283 | | - SerializableFunction<Map<String, Object>, Admin> adminFactoryFn) { |
1284 | | - return toBuilder().setAdminFactoryFn(adminFactoryFn).build(); |
1285 | | - } |
1286 | | - |
1287 | 1269 | /** |
1288 | 1270 | * A factory to create Kafka {@link Consumer} from consumer configuration. This is useful for |
1289 | 1271 | * supporting another version of Kafka consumer. Default is {@link KafkaConsumer}. |
@@ -1934,7 +1916,6 @@ public PCollection<KafkaRecord<K, V>> expand(PBegin input) { |
1934 | 1916 | ReadSourceDescriptors.<K, V>read() |
1935 | 1917 | .withConsumerConfigOverrides(kafkaRead.getConsumerConfig()) |
1936 | 1918 | .withOffsetConsumerConfigOverrides(kafkaRead.getOffsetConsumerConfig()) |
1937 | | - .withAdminFactoryFn(kafkaRead.getAdminFactoryFn()) |
1938 | 1919 | .withConsumerFactoryFn(kafkaRead.getConsumerFactoryFn()) |
1939 | 1920 | .withKeyDeserializerProviderAndCoder( |
1940 | 1921 | kafkaRead.getKeyDeserializerProvider(), keyCoder) |
@@ -2451,9 +2432,6 @@ public abstract static class ReadSourceDescriptors<K, V> |
2451 | 2432 | @Pure |
2452 | 2433 | abstract @Nullable Coder<V> getValueCoder(); |
2453 | 2434 |
|
2454 | | - @Pure |
2455 | | - abstract SerializableFunction<Map<String, Object>, Admin> getAdminFactoryFn(); |
2456 | | - |
2457 | 2435 | @Pure |
2458 | 2436 | abstract SerializableFunction<Map<String, Object>, Consumer<byte[], byte[]>> |
2459 | 2437 | getConsumerFactoryFn(); |
@@ -2504,9 +2482,6 @@ abstract static class Builder<K, V> { |
2504 | 2482 | abstract ReadSourceDescriptors.Builder<K, V> setOffsetConsumerConfig( |
2505 | 2483 | @Nullable Map<String, Object> offsetConsumerConfig); |
2506 | 2484 |
|
2507 | | - abstract ReadSourceDescriptors.Builder<K, V> setAdminFactoryFn( |
2508 | | - SerializableFunction<Map<String, Object>, Admin> adminFactoryFn); |
2509 | | - |
2510 | 2485 | abstract ReadSourceDescriptors.Builder<K, V> setConsumerFactoryFn( |
2511 | 2486 | SerializableFunction<Map<String, Object>, Consumer<byte[], byte[]>> consumerFactoryFn); |
2512 | 2487 |
|
@@ -2561,7 +2536,6 @@ abstract ReadSourceDescriptors.Builder<K, V> setBadRecordErrorHandler( |
2561 | 2536 |
|
2562 | 2537 | public static <K, V> ReadSourceDescriptors<K, V> read() { |
2563 | 2538 | return new AutoValue_KafkaIO_ReadSourceDescriptors.Builder<K, V>() |
2564 | | - .setAdminFactoryFn(KafkaIOUtils.KAFKA_ADMIN_FACTORY_FN) |
2565 | 2539 | .setConsumerFactoryFn(KafkaIOUtils.KAFKA_CONSUMER_FACTORY_FN) |
2566 | 2540 | .setConsumerConfig(KafkaIOUtils.DEFAULT_CONSUMER_PROPERTIES) |
2567 | 2541 | .setCommitOffsetEnabled(false) |
@@ -2662,15 +2636,6 @@ public ReadSourceDescriptors<K, V> withValueDeserializerProviderAndCoder( |
2662 | 2636 | .build(); |
2663 | 2637 | } |
2664 | 2638 |
|
2665 | | - /** |
2666 | | - * A factory to create Kafka {@link Admin} from offset consumer configuration. This is useful |
2667 | | - * for supporting another version of Kafka admin. Default is {@link Admin#create(Map)}. |
2668 | | - */ |
2669 | | - public ReadSourceDescriptors<K, V> withAdminFactoryFn( |
2670 | | - SerializableFunction<Map<String, Object>, Admin> adminFactoryFn) { |
2671 | | - return toBuilder().setAdminFactoryFn(adminFactoryFn).build(); |
2672 | | - } |
2673 | | - |
2674 | 2639 | /** |
2675 | 2640 | * A factory to create Kafka {@link Consumer} from consumer configuration. This is useful for |
2676 | 2641 | * supporting another version of Kafka consumer. Default is {@link KafkaConsumer}. |
|
0 commit comments