fozzie15 commented on code in PR #35085: URL: https://github.com/apache/beam/pull/35085#discussion_r2219549162
########## sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaReadSchemaTransformProvider.java: ########## @@ -178,16 +193,45 @@ public PCollectionRowTuple expand(PCollectionRowTuple input) { if (confluentSchemaRegUrl != null) { final String confluentSchemaRegSubject = checkArgumentNotNull(configuration.getConfluentSchemaRegistrySubject()); - KafkaIO.Read<byte[], GenericRecord> kafkaRead = + KafkaIO.Read<byte[], GenericRecord> kafkaRead; + + kafkaRead = KafkaIO.<byte[], GenericRecord>read() .withTopic(configuration.getTopic()) .withConsumerFactoryFn(new ConsumerFactoryWithGcsTrustStores()) .withBootstrapServers(configuration.getBootstrapServers()) .withConsumerConfigUpdates(consumerConfigs) - .withKeyDeserializer(ByteArrayDeserializer.class) - .withValueDeserializer( + .withKeyDeserializer(ByteArrayDeserializer.class); + + SchemaRegistryProvider provider = getSchemaRegistryProvider(confluentSchemaRegUrl); + switch (provider) { + case GOOGLE_MANAGED: + // Custom configs to authenticate with Google's Managed Schema Registry + Map<String, Object> configs = new HashMap<>(); + configs.put( + KafkaAvroDeserializerConfig.SCHEMA_REGISTRY_URL_CONFIG, confluentSchemaRegUrl); + configs.put(KafkaAvroDeserializerConfig.BEARER_AUTH_CREDENTIALS_SOURCE, "CUSTOM"); + configs.put( + "bearer.auth.custom.provider.class", + "com.google.cloud.hosted.kafka.auth.GcpBearerAuthCredentialProvider"); + + LOG.info( Review Comment: Good Call. Redacting the URL. -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org