Skip to content

NIFI-16241 Fix PublishAMQP handling of blank Routing Key - #11578

Draft
ing-mattioni wants to merge 1 commit into
apache:mainfrom
ing-mattioni:NIFI-16241-publishamqp-routing-key-failure
Draft

NIFI-16241 Fix PublishAMQP handling of blank Routing Key#11578
ing-mattioni wants to merge 1 commit into
apache:mainfrom
ing-mattioni:NIFI-16241-publishamqp-routing-key-failure

Conversation

@ing-mattioni

@ing-mattioni ing-mattioni commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-16241

This pull request updates PublishAMQP to route FlowFiles to the failure relationship when the evaluated Routing Key is null, empty, or whitespace-only. This prevents invalid FlowFiles from being rolled back and repeatedly processed.

Changes

  • Fix PublishAMQP handling of blank Routing Key

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

  • Added regression tests for missing, empty, and whitespace-only evaluated Routing Keys.
  • Verified that affected FlowFiles are transferred to failure and removed from the input queue.
  • Not run locally because Java/JAVA_HOME is not available in the environment.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Module-level verification performed:

.\mvnw.cmd -pl :nifi-amqp-processors -am test

Additional verification performed:

.\mvnw.cmd -pl :nifi-amqp-processors -am -P contrib-check install -DskipTests

.\mvnw.cmd -pl :nifi-amqp-nar -am install -DskipTests

Licensing

  • New dependencies are compatible with the Apache License 2.0
  • New dependencies are documented in applicable LICENSE and NOTICE files

No new dependencies were added.

Documentation

  • Documentation formatting appears as expected in rendered files

No user-facing documentation files were changed.

@ing-mattioni
ing-mattioni force-pushed the NIFI-16241-publishamqp-routing-key-failure branch 2 times, most recently from 97b6c92 to 1363488 Compare August 21, 2026 16:12
@ing-mattioni
ing-mattioni force-pushed the NIFI-16241-publishamqp-routing-key-failure branch from 1363488 to 4d9574f Compare August 24, 2026 08:32

@exceptionfactory exceptionfactory 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.

@ing-mattioni Are you still working on this, or is it ready to review? Changing from throwing an exception to routing to failure alters the behavior in a notable way, so that needs some consideration.

@ing-mattioni

Copy link
Copy Markdown
Contributor Author

@exceptionfactory for me it is ready to review but it is not a problem if you and the team decide that dhanging from throwing an exception to routing to failure is not acceptable as a change (in my use case it will be probably be better, but I undestand that in other scenarios it could be worse or not optimal)

@exceptionfactory

Copy link
Copy Markdown
Contributor

Thanks @ing-mattioni. One straightforward option is to add the isBlank() check and throw the same exception, but not route to failure. It is arguable that lack of the Routing Key is a configuration problem, which makes the exception the more applicable approach. If input FlowFiles may or may not have the required attributes, it would be better to design the flow accordingly, using RouteOnAttribute or similar.

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