Skip to content

Commit

Permalink
MINIFICPP-2498 Funnels should be usable as terminators
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fgerlits committed Feb 13, 2025
1 parent a2f8851 commit faa56b8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docker/test/integration/features/core_functionality.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions libminifi/include/Funnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 26 additions & 0 deletions libminifi/src/Funnel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* 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.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "Funnel.h"

namespace org::apache::nifi::minifi {

void Funnel::onSchedule(core::ProcessContext&, core::ProcessSessionFactory&) {
addAutoTerminatedRelationship(Success);
}

} // namespace org::apache::nifi::minifi

0 comments on commit faa56b8

Please sign in to comment.