nghiaxlee commented on a change in pull request #710: MINIFICPP - 1110,1111 - 
PublishKafka, OPC processors should config and
URL: https://github.com/apache/nifi-minifi-cpp/pull/710#discussion_r374837145
 
 

 ##########
 File path: extensions/librdkafka/PublishKafka.cpp
 ##########
 @@ -141,6 +141,59 @@ void PublishKafka::initialize() {
 
 void PublishKafka::onSchedule(const std::shared_ptr<core::ProcessContext> 
&context, const std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) {
   interrupted_ = false;
+
+  // Try to get a KafkaConnection
+  std::string client_id, brokers;
+  if (!context->getProperty(ClientName.getName(), client_id)) {
+    throw Exception(PROCESS_SCHEDULE_EXCEPTION, "Client Name property missing 
or invalid");
+  }
+  if (!context->getProperty(SeedBrokers.getName(), brokers)) {
+    throw Exception(PROCESS_SCHEDULE_EXCEPTION, "Known Brokers property 
missing or invalid");
+  }
+
+  // Get some properties not (only) used directly to set up librdkafka
+  std::string value;
+
+  // Batch Size
+  value = "";
+  if (context->getProperty(BatchSize.getName(), batch_size_)) {
+    logger_->log_debug("PublishKafka: Batch Size [%lu]", batch_size_);
+  } else {
+    batch_size_ = 10;
+  }
+
+  // Target Batch Payload Size
+  value = "";
+  if (context->getProperty(TargetBatchPayloadSize.getName(), 
target_batch_payload_size_)) {
+    logger_->log_debug("PublishKafka: Target Batch Payload Size [%llu]", 
target_batch_payload_size_);
+  } else {
+    target_batch_payload_size_ = 512 * 1024U;
+  }
+
+  // Max Flow Segment Size
+  value = "";
+  if (context->getProperty(MaxFlowSegSize.getName(), max_flow_seg_size_)) {
+    logger_->log_debug("PublishKafka: Max Flow Segment Size [%llu]", 
max_flow_seg_size_);
+  } else {
+    max_flow_seg_size_ = 0U;
 
 Review comment:
   Fixed, we already had default value, maybe we were overcareful

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to