Skip to content

MINIFICPP-2797 Extend C Api with sslcontext, penalize, dynamic properties, flowfile id and size#2166

Open
martinzink wants to merge 5 commits intoapache:mainfrom
martinzink:MINIFICPP-2797
Open

MINIFICPP-2797 Extend C Api with sslcontext, penalize, dynamic properties, flowfile id and size#2166
martinzink wants to merge 5 commits intoapache:mainfrom
martinzink:MINIFICPP-2797

Conversation

@martinzink
Copy link
Copy Markdown
Member

MINIFICPP-2797
There are a couple functions missing from the stable API that prevents us to migrate Kafka,
namely penalize, sslcontext functionality, dynamic property handling, flowfile id and flowfile size


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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends the MiNiFi C extension API to expose additional ProcessSession/ProcessContext capabilities needed by external extensions (e.g., Kafka migration), including penalization, FlowFile metadata access, dynamic properties enumeration, and SSLContextService data access.

Changes:

  • Adds new exported C API functions (penalize, flowfile id/size, dynamic properties, SSL data) and renames FlowFile attribute functions under MinifiProcessSession*.
  • Implements the new API surface in libminifi/src/minifi-c.cpp.
  • Updates the C++ extension wrapper (cpp-extension-lib) to call the renamed attribute APIs.

Reviewed changes

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

File Description
minifi-api/minifi-c-api.def Updates Windows export list with new/renamed C API symbols.
minifi-api/include/minifi-c/minifi-c.h Adds new C API declarations/constants and SSL data struct/callback.
libminifi/src/minifi-c.cpp Implements new C API functions for penalize, flowfile metadata, dynamic properties, and SSL data.
extension-framework/cpp-extension-lib/src/core/ProcessSession.cpp Migrates wrapper to renamed attribute APIs.

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

@apache apache deleted a comment from Copilot AI Apr 29, 2026
@apache apache deleted a comment from Copilot AI Apr 29, 2026
@apache apache deleted a comment from Copilot AI Apr 29, 2026
@apache apache deleted a comment from Copilot AI Apr 29, 2026
@apache apache deleted a comment from Copilot AI Apr 29, 2026
@apache apache deleted a comment from Copilot AI Apr 29, 2026
@martinzink martinzink requested a review from Copilot April 29, 2026 09:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Comment thread minifi-api/minifi-c-api.def
Comment thread minifi-api/include/minifi-c/minifi-c.h Outdated
Comment thread minifi-api/include/minifi-c/minifi-c.h
Comment thread minifi-api/include/minifi-c/minifi-c.h Outdated
Comment thread minifi-api/include/minifi-c/minifi-c.h Outdated
Comment thread libminifi/src/minifi-c.cpp
@martinzink martinzink marked this pull request as ready for review April 29, 2026 13:14
@szaszm szaszm self-requested a review May 4, 2026 12:13
Comment thread extension-framework/cpp-extension-lib/src/core/ProcessSession.cpp
Comment thread libminifi/src/minifi-c.cpp Outdated
Comment thread libminifi/src/minifi-c.cpp
Comment on lines +624 to +627
const std::string ca_cert_file = ssl_context_service->getCACertificate().string();
const std::string passphrase = ssl_context_service->getPassphrase();
const std::string cert_file = ssl_context_service->getCertificateFile().string();
const std::string private_key_file = ssl_context_service->getPrivateKeyFile().string();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to handle exceptions here, so that no C++ exceptions cross the C API boundary. And ideally we should handle string allocation errors too.

#define MINIFI_REGISTER_EXTENSION_FN MinifiRegisterExtension
#endif

/// To allow the proper usage of SSLContextServices set the MinifiPropertyDefinition::type to MINIFI_SSL_CONTEXT_SERVICE_PROPERTY_TYPE
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't really describe what proper usage means, so I would rephrase it to something like: "To declare a processor property that expects an SSLContextService, use MINIFI_SSL_CONTEXT_SERVICE_PROPERTY_TYPE in the type field of the property definition (MinifiPropertyDefinition::type)"

void* user_ctx);

typedef struct MinifiSslData {
uint8_t version;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm thinking we can probably do without this version field, and just rely on the extension API version in case the layout ever changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants