Skip to content

MINIFICPP-2731 Allow cancellation from ProcessSession::write#2120

Open
martinzink wants to merge 4 commits intoapache:mainfrom
martinzink:MINIFICPP-2731
Open

MINIFICPP-2731 Allow cancellation from ProcessSession::write#2120
martinzink wants to merge 4 commits intoapache:mainfrom
martinzink:MINIFICPP-2731

Conversation

@martinzink
Copy link
Member

This is required to support fluid streaming api.

Currently if we opened the OutputStream it will always replace the old content, but lets say a processor wants to process flowfile content as a stream (read current content and write the new content at the same time), but if something comes up it might want to drop all changes and route the FlowFile to failure.


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

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

Enables a processor to cancel an in-progress ProcessSession::write operation (e.g., while streaming) without committing the newly written content, by signaling cancellation from the write callback and discarding the temporary ResourceClaim.

Changes:

  • Added ContentSession::remove(...) to allow abandoning newly created/managed ResourceClaims.
  • Introduced a C API status enum (MinifiIoStatus) with a cancellation code.
  • Updated ProcessSessionImpl::write to detect cancellation from the callback and discard the new claim instead of overwriting the FlowFile’s content.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
minifi-api/include/minifi-cpp/core/ContentSession.h Adds remove(...) to the content session interface.
minifi-api/include/minifi-c/minifi-c.h Adds MinifiIoStatus with a cancel status value.
libminifi/src/core/ProcessSession.cpp Implements cancellation handling in write(...) based on callback return value.
libminifi/src/core/ForwardingContentSession.cpp Implements remove(...) by dropping claim/session bookkeeping.
libminifi/include/core/ForwardingContentSession.h Declares the new remove(...) override.
core-framework/src/core/BufferedContentSession.cpp Implements remove(...) to discard buffered state for a claim.
core-framework/include/core/BufferedContentSession.h Declares the new remove(...) override.

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

Copy link

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 10 out of 10 changed files in this pull request and generated 2 comments.


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

@martinzink martinzink marked this pull request as draft February 25, 2026 13:57
@martinzink martinzink marked this pull request as ready for review February 25, 2026 20:34
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.

2 participants