Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/421#discussion_r226309091
--- Diff: libminifi/src/capi/Plan.cpp ---
@@ -202,29 +180,31 @@ std::shared_ptr<core::ProcessSession>
ExecutionPlan::getCurrentSession() {
return current_session_;
}
-std::shared_ptr<minifi::Connection>
ExecutionPlan::buildFinalConnection(std::shared_ptr<core::Processor> processor,
bool setDest) {
- std::stringstream connection_name;
- std::shared_ptr<core::Processor> last = processor;
- connection_name << last->getUUIDStr() << "-to-" <<
processor->getUUIDStr();
- std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(flow_repo_, content_repo_,
connection_name.str());
- connection->setRelationship(termination_);
+std::shared_ptr<minifi::Connection>
ExecutionPlan::buildFinalConnection(std::shared_ptr<core::Processor> processor,
bool set_dst) {
+ return connectProcessors(processor, processor, termination_, set_dst);
+}
- // link the connections so that we can test results at the end for this
- connection->setSource(last);
- if (setDest)
- connection->setDestination(processor);
+void ExecutionPlan::finalize() {
+ if (failure_handler_) {
+ auto failure_proc = createProcessor("CallbackProcessor",
"CallbackProcessor");
- utils::Identifier uuid_copy;
- last->getUUID(uuid_copy);
- connection->setSourceUUID(uuid_copy);
- if (setDest)
- connection->setDestinationUUID(uuid_copy);
+ std::shared_ptr<processors::CallbackProcessor> callback_proc =
std::static_pointer_cast<processors::CallbackProcessor>(failure_proc);
+ callback_proc->setCallback(nullptr,
std::bind(&FailureHandler::operator(), failure_handler_,
std::placeholders::_1));
- processor->addConnection(connection);
- return connection;
-}
+ for (const auto& proc : processor_queue_) {
+ relationships_.push_back(connectProcessors(proc, failure_proc,
core::Relationship("failure", "failure collector"), true));
--- End diff --
Are you checking processors to see if they have a failure relationship?
---