KKcorps commented on code in PR #12068:
URL: https://github.com/apache/pinot/pull/12068#discussion_r1415638532
##########
pinot-plugins/pinot-stream-ingestion/pinot-pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarPartitionLevelConnectionHandler.java:
##########
@@ -60,13 +65,34 @@ public PulsarPartitionLevelConnectionHandler(String
clientId, StreamConfig strea
pulsarClientBuilder.authentication(authentication);
}
+
getAuthenticationFactory(_config).ifPresent(pulsarClientBuilder::authentication);
_pulsarClient = pulsarClientBuilder.build();
LOGGER.info("Created pulsar client {}", _pulsarClient);
} catch (Exception e) {
LOGGER.error("Could not create pulsar consumer", e);
}
}
+ private Optional<Authentication> getAuthenticationFactory(PulsarConfig
pulsarConfig) {
+ if (StringUtils.isNotBlank(pulsarConfig.getIssuerUrl())
+ && StringUtils.isBlank(pulsarConfig.getAudience())
+ && StringUtils.isBlank(pulsarConfig.getCredentialsFilePath())) {
+ try {
+ return Optional.of(AuthenticationFactoryOAuth2.clientCredentials(
+ new URL(pulsarConfig.getIssuerUrl()),
+ new URL(pulsarConfig.getCredentialsFilePath()),
+ pulsarConfig.getAudience()));
+ } catch (MalformedURLException mue) {
Review Comment:
Do we need to handle any other exceptions in this block?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]