Skip to content

MINIFICPP-2867 Implement ForkEnrichment/JoinEnrichmentAttributes - #2221

Open
martinzink wants to merge 3 commits into
mainfrom
enrichment_processors
Open

MINIFICPP-2867 Implement ForkEnrichment/JoinEnrichmentAttributes#2221
martinzink wants to merge 3 commits into
mainfrom
enrichment_processors

Conversation

@martinzink

Copy link
Copy Markdown
Member

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new “enrichment fork/join” mechanism to MiNiFi C++ standard processors, enabling a FlowFile to be cloned for enrichment and later rejoined with merged attributes.

Changes:

  • Added new ForkEnrichment and JoinEnrichmentAttributes processors (including attribute keys shared via a small utility header).
  • Added unit tests and a Behave feature test validating enrichment + join behavior.
  • Updated processor documentation, Behave step definitions, and the GitHub reference manifest to include the new processors.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
PROCESSORS.md Documents the new processors, their properties, relationships, and output attributes.
extensions/standard-processors/utils/EnrichmentUtils.h Introduces shared attribute-name constants for enrichment correlation/role.
extensions/standard-processors/processors/ForkEnrichment.h Declares the fork processor (clones FlowFiles and sets correlation/role attributes).
extensions/standard-processors/processors/ForkEnrichment.cpp Implements cloning + attribute assignment + routing logic.
extensions/standard-processors/processors/JoinEnrichmentAttributes.h Declares the join processor (pairing/timeout tracking and join output).
extensions/standard-processors/processors/JoinEnrichmentAttributes.cpp Implements pairing by group id, merging attributes, and timeout routing.
extensions/standard-processors/tests/unit/ForkEnrichmentTests.cpp Unit coverage for basic fork behavior and max-batch handling.
extensions/standard-processors/tests/unit/JoinEnrichmentAttributesTests.cpp Unit coverage for invalid inputs, pairing behavior, and timeout/max-batch.
extensions/standard-processors/tests/features/enrichment.feature End-to-end Behave scenario verifying enrichment + join in a composed flow.
behave_framework/src/minifi_behave/steps/flow_building_steps.py Adds “an …” variants for processor step definitions used by the new feature.
.github/references/ubuntu_22_04_clang_arm_manifest.json Registers the new processors and their property/relationship metadata in the reference manifest.
Comments suppressed due to low confidence (1)

extensions/standard-processors/processors/JoinEnrichmentAttributes.h:131

  • Typo in comment: "cant" -> "can't".
  // We need to track current session's FlowFiles (we cant add those)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extensions/standard-processors/utils/EnrichmentUtils.h
Comment on lines +20 to +28
#include <memory>
#include <string>

#include "core/FlowFileStore.h"
#include "core/ProcessorImpl.h"
#include "core/PropertyDefinitionBuilder.h"
#include "minifi-cpp/core/PropertyDefinition.h"
#include "utils/Enum.h"
#include "utils/RegexUtils.h"
Comment on lines +18 to +22
#include "JoinEnrichmentAttributes.h"
#include "unit/Catch.h"
#include "unit/ProcessorUtils.h"
#include "unit/SingleProcessorTestController.h"
#include "utils/EnrichmentUtils.h"
Comment thread extensions/standard-processors/tests/features/enrichment.feature Outdated
}

if (const auto pair_node = pair_map.extract(group_id)) {
logger_->log_trace("Match found");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could log the group id to see which group id the match was found for.

};
} // namespace join_enrichment_attributes

using MapType = std::unordered_map<std::string, std::shared_ptr<core::FlowFile>, utils::string::transparent_string_hash, std::equal_to<>>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be renamed to be a bit more descriptive.


core::FlowFileStore flow_file_store_;
// We need to track current session's FlowFiles (we cant add those)
std::vector<utils::Identifier> session_flow_files_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only addition and contains functionality is used for this container without need for ordering, it may be better to use unordered_set for this.

@martinzink
martinzink force-pushed the enrichment_processors branch from bcfed19 to f5ec2a8 Compare August 18, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants