dan-s1 commented on code in PR #9807:
URL: https://github.com/apache/nifi/pull/9807#discussion_r1999234064
##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-service/src/main/java/org/apache/nifi/kafka/service/Kafka3ConnectionService.java:
##########
@@ -249,15 +252,33 @@ public class Kafka3ConnectionService extends
AbstractControllerService implement
private volatile ServiceConfiguration serviceConfiguration;
private volatile Properties producerProperties;
private volatile Properties consumerProperties;
+ private volatile String uri;
@OnEnabled
public void onEnabled(final ConfigurationContext configurationContext) {
clientProperties = getClientProperties(configurationContext);
serviceConfiguration = getServiceConfiguration(configurationContext);
producerProperties = getProducerProperties(configurationContext,
clientProperties);
consumerProperties = getConsumerProperties(configurationContext,
clientProperties);
+ uri = createBrokerUri(configurationContext);
}
+ private String createBrokerUri(final ConfigurationContext context) {
+ final String bootstrapServers =
context.getProperty(BOOTSTRAP_SERVERS).getValue();
+ final String[] bootstrapServersArray = bootstrapServers.split(",");
+ String firstBootstrapServer = bootstrapServersArray[0].trim();
+ if (firstBootstrapServer.contains("://")) {
+ firstBootstrapServer =
firstBootstrapServer.substring(firstBootstrapServer.indexOf("://") + 3);
Review Comment:
I am sorry for my ignorance here regarding Kafka configuration but will all
the configured servers always have `://`? The way I read the Kafka
documentation `host:port` where host may not include the leading `://`hence
`firstBootstrapServer.indexOf("://")` may return `-1`.
--
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]