szaszm commented on a change in pull request #1120:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1120#discussion_r704286483



##########
File path: extensions/librdkafka/ConsumeKafka.cpp
##########
@@ -211,14 +218,22 @@ void ConsumeKafka::onSchedule(core::ProcessContext* 
context, core::ProcessSessio
   context->getProperty(MessageHeaderEncoding.getName(), 
message_header_encoding_);
   context->getProperty(DuplicateHeaderHandling.getName(), 
duplicate_header_handling_);
 
+  std::string ssl_service_name;
+  std::shared_ptr<minifi::controllers::SSLContextService> ssl_service;
+  if (context->getProperty(SSLContextService.getName(), ssl_service_name) && 
!ssl_service_name.empty()) {
+    std::shared_ptr<core::controller::ControllerService> service = 
context->getControllerService(ssl_service_name);
+    if (service) {
+      ssl_service = 
std::static_pointer_cast<minifi::controllers::SSLContextService>(service);
+      ssl_data_.ca_loc = ssl_service->getCACertificate();
+      ssl_data_.cert_loc = ssl_service->getCertificateFile();
+      ssl_data_.key_loc = ssl_service->getPrivateKeyFile();
+      ssl_data_.key_pw = ssl_service->getPassphrase();
+    }
+  }

Review comment:
       I think a warning log would be helpful, when the SSLContextService 
property is present, but the name lookup or the conversion didn't yield a valid 
ssl context service.

##########
File path: extensions/librdkafka/PublishKafka.cpp
##########
@@ -709,37 +717,70 @@ bool PublishKafka::configureNewConnection(const 
std::shared_ptr<core::ProcessCon
         auto error_msg = utils::StringUtils::join_pack(PREFIX_ERROR_MSG, 
errstr.data());
         throw Exception(PROCESS_SCHEDULE_EXCEPTION, error_msg);
       }
-      value = "";
-      if (context->getProperty(SecurityCA.getName(), value) && !value.empty()) 
{
-        result = rd_kafka_conf_set(conf_.get(), "ssl.ca.location", 
value.c_str(), errstr.data(), errstr.size());
-        logger_->log_debug("PublishKafka: ssl.ca.location [%s]", value);
+
+      std::shared_ptr<minifi::controllers::SSLContextService> ssl_service;
+      if (context->getProperty(SSLContextService.getName(), value) && 
!value.empty()) {
+        std::shared_ptr<core::controller::ControllerService> service = 
context->getControllerService(value);
+        if (service) {
+          ssl_service = 
std::static_pointer_cast<minifi::controllers::SSLContextService>(service);
+        }
+      }

Review comment:
       Same here. Maybe it's also worth a log message if SSL protocol is 
selected, but neither SSLContextService nor the individual properties are 
present.




-- 
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]


Reply via email to