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-10411 Add record processing feature to PublishMQTT processor #6373

Closed
wants to merge 2 commits into from

Conversation

nandorsoma
Copy link
Contributor

Summary

NIFI-10411

This pr adds record processing feature to PublishMQTT processor. I also made a little bit of cleanup around the tests because the current structure is no longer useful (in the past multiple Test extended the Common one) and now it just makes the code difficult to understand.

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 8
    • JDK 11
    • JDK 17

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

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

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

@nandorsoma Thanks for adding this new feature in PublishMQTT!

I tested it with different inputs (valid / invalid records) and it works as expected. The prod code looks good to me but I haven't reviewed the tests yet.

I added a comment about the descriptions of Record Reader/Writer properties and one more about the Json library being used.

Will look into the tests in more detail soon.

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

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

@nandorsoma Reviewed the tests and only found some minor improvement points. Could you please check my comments? Thanks

@nandorsoma
Copy link
Contributor Author

Thank you for your reviews @turcsanyip and @exceptionfactory! Please see my latest commit!

topic = "testTopic";
testRunner.setProperty(PublishMQTT.PROP_TOPIC, topic);
private static ArrayNode createTestJsonInput() {
final ObjectMapper mapper = new ObjectMapper();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is a best practice to initialize ObjectMapper once and store it in a static field because it seems to be a heavy-weight object but thread-safe.

It can be modified in a future commit. Will go ahead with merging this PR.

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

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

@nandorsoma Thanks for the review changes!

@exceptionfactory Thanks for your recommendation on json libraries! The code has been modified to use Jackson.

Added a comment about a possible minor improvement that can be implemented later.

+1 LGTM
Merging to main.

@asfgit asfgit closed this in eb68ffa Sep 9, 2022
p-kimberley pushed a commit to p-kimberley/nifi that referenced this pull request Oct 15, 2022
This closes apache#6373.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants