This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 5fe1078805a9af17d071a645ac5b15fbf31e5786 Author: Ferenc Gerlits <[email protected]> AuthorDate: Tue Feb 18 13:30:14 2025 +0100 MINIFICPP-2498 Funnels should be usable as terminators The output relationship of a funnel is now auto-terminated by default. You can connect it to a processor's input, but you don't have to. Closes #1914 Signed-off-by: Marton Szasz <[email protected]> --- .../integration/features/core_functionality.feature | 8 ++++++++ libminifi/include/Funnel.h | 2 ++ libminifi/{include/Funnel.h => src/Funnel.cpp} | 18 ++++-------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docker/test/integration/features/core_functionality.feature b/docker/test/integration/features/core_functionality.feature index ef4bc5df2..21b071f64 100644 --- a/docker/test/integration/features/core_functionality.feature +++ b/docker/test/integration/features/core_functionality.feature @@ -39,6 +39,14 @@ Feature: Core flow functionalities Then at least one flowfile with the content "first_custom_text" is placed in the monitored directory in less than 20 seconds And at least one flowfile with the content "second_custom_text" is placed in the monitored directory in less than 20 seconds + @CORE + Scenario: A funnel can be used as a terminator + Given a GenerateFlowFile processor with the "Data Format" property set to "Text" + And a Funnel with the name "TerminalFunnel" is set up + And the "success" relationship of the GenerateFlowFile processor is connected to the TerminalFunnel + When the MiNiFi instance starts up + Then the Minifi logs do not contain the following message: "Connect empty for non auto terminated relationship" after 5 seconds + @CORE Scenario: The default configuration uses RocksDB for both the flow file and content repositories Given a GenerateFlowFile processor with the "Data Format" property set to "Text" diff --git a/libminifi/include/Funnel.h b/libminifi/include/Funnel.h index dfdcca7df..b6b3a7363 100644 --- a/libminifi/include/Funnel.h +++ b/libminifi/include/Funnel.h @@ -31,6 +31,8 @@ class Funnel final : public ForwardingNode { MINIFIAPI static constexpr core::annotation::Input InputRequirement = core::annotation::Input::INPUT_REQUIRED; ADD_COMMON_VIRTUAL_FUNCTIONS_FOR_PROCESSORS + + void onSchedule(core::ProcessContext&, core::ProcessSessionFactory&) override; }; } // namespace org::apache::nifi::minifi diff --git a/libminifi/include/Funnel.h b/libminifi/src/Funnel.cpp similarity index 61% copy from libminifi/include/Funnel.h copy to libminifi/src/Funnel.cpp index dfdcca7df..fee7ccf78 100644 --- a/libminifi/include/Funnel.h +++ b/libminifi/src/Funnel.cpp @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -15,22 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#pragma once - -#include <string> -#include <utility> -#include "ForwardingNode.h" +#include "Funnel.h" namespace org::apache::nifi::minifi { -class Funnel final : public ForwardingNode { - public: - Funnel(std::string_view name, const utils::Identifier& uuid) : ForwardingNode(name, uuid, core::logging::LoggerFactory<Funnel>::getLogger(uuid)) {} - explicit Funnel(std::string_view name) : ForwardingNode(name, core::logging::LoggerFactory<Funnel>::getLogger()) {} - - MINIFIAPI static constexpr core::annotation::Input InputRequirement = core::annotation::Input::INPUT_REQUIRED; - ADD_COMMON_VIRTUAL_FUNCTIONS_FOR_PROCESSORS -}; +void Funnel::onSchedule(core::ProcessContext&, core::ProcessSessionFactory&) { + addAutoTerminatedRelationship(Success); +} } // namespace org::apache::nifi::minifi
