Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-14367 Removed casting to BufferedInputStream in PublishKafka #9804

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sammu97
Copy link

@sammu97 sammu97 commented Mar 14, 2025

  • This PR aims to fix issues arising when the Kafka Publisher process attempts to infer a schema from a Json Payload greater than 1 MB. This is because the mark() limit set on the current input stream is statically set at 1000000. This fix removes to casting of the Input Stream to a Buffer Input Stream, thus omitting the dependency on the mark() function.

Summary

NIFI-14367

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 Formatting

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

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 21

Licensing

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

Documentation

  • Documentation formatting appears as expected in rendered files

- Keeping original input stream during Kafka publish
@sammu97 sammu97 marked this pull request as ready for review March 14, 2025 16:38
Copy link
Contributor

@pvillard31 pvillard31 left a comment

Choose a reason for hiding this comment

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

Thanks for the change @sammu97 - would you mind adding a unit test or integration test to confirm the change / fix?

@sammu97
Copy link
Author

sammu97 commented Mar 14, 2025

Hi @pvillard31 , sure will do. Will need to give some thought about how to best go about testing this.

@sammu97 sammu97 marked this pull request as draft March 14, 2025 22:44
@sammu97
Copy link
Author

sammu97 commented Mar 14, 2025

Hi @pvillard31 , I've added 2 tests for the KafkaRecordConverter, however am finding it difficult to mock a RecordStreamKafkaRecordConverter and RecordWrapperStreamKafkaRecordConverter due to the RecordSetWriterFactory and RecordReaderFactory objects needed. Would appreciate some guidance here

- Added further tests for KafkaRecordConverter and refactored existing code
- Added License headers
@sammu97
Copy link
Author

sammu97 commented Mar 15, 2025

Hi @pvillard31 , I have added further tests for all KafkaRecordConverter classes, let me know what you think.

@sammu97 sammu97 marked this pull request as ready for review March 15, 2025 12:10
@sammu97 sammu97 requested a review from pvillard31 March 15, 2025 19:26
@pvillard31
Copy link
Contributor

Hi @sammu97 - thanks for adding the tests! I did a larger refactor of the Kafka components in this PR #9807 and I retained your commit that is adding the tests to confirm that it's working with the refactored approach.

@sammu97
Copy link
Author

sammu97 commented Mar 17, 2025

Great @pvillard31 , thank you and looking forward to having this released 😄

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