fgerlits commented on a change in pull request #1257:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1257#discussion_r804513746
##########
File path: extensions/standard-processors/processors/TailFile.cpp
##########
@@ -398,6 +410,23 @@ void TailFile::onSchedule(const
std::shared_ptr<core::ProcessContext> &context,
initial_start_position_ =
InitialStartPositions{utils::parsePropertyWithAllowableValuesOrThrow(*context,
InitialStartPosition.getName(), InitialStartPositions::values())};
}
+void TailFile::parseAttributeProviderServiceProperty(core::ProcessContext&
context) {
+ const auto attribute_provider_service_name =
context.getProperty(AttributeProviderService);
+ if (!attribute_provider_service_name ||
attribute_provider_service_name->empty()) {
+ return;
+ }
+
+ std::shared_ptr<core::controller::ControllerService> controller_service =
context.getControllerService(*attribute_provider_service_name);
+ if (!controller_service) {
+ throw minifi::Exception{ExceptionType::PROCESS_SCHEDULE_EXCEPTION,
utils::StringUtils::join_pack("Controller service '",
*attribute_provider_service_name, "' not found")};
+ }
+
+ attribute_provider_service_ =
dynamic_cast<minifi::controllers::AttributeProviderService*>(controller_service.get());
+ if (!attribute_provider_service_) {
+ throw minifi::Exception{ExceptionType::PROCESS_SCHEDULE_EXCEPTION,
utils::StringUtils::join_pack("Controller service '",
*attribute_provider_service_name, "' is not an AttributeProviderService")};
+ }
Review comment:
I think the root cause of the problem is that
`context.getControllerService()` returns a `shared_ptr` instead of a non-owning
pointer, probably because MiNiFi was originally ported from Java. In the long
term, we'll probably want to fix this. For now, I have added a comment.
--
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]