Skip to content

MINIFICPP-1440 PublishKafka processor's "security protocol" should ha…#961

Closed
dam4rus wants to merge 2 commits intoapache:mainfrom
dam4rus:MINIFICPP-1440
Closed

MINIFICPP-1440 PublishKafka processor's "security protocol" should ha…#961
dam4rus wants to merge 2 commits intoapache:mainfrom
dam4rus:MINIFICPP-1440

Conversation

@dam4rus
Copy link
Contributor

@dam4rus dam4rus commented Dec 16, 2020

…ve allowable values

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
Member

@szaszm szaszm 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 your first contribution. We generally merge PRs after 2-3 approvals and when all comments are resolved. In case there are any questions, feel free to reach out.

const core::Property PublishKafka::SecurityProtocol(
core::PropertyBuilder::createProperty("Security Protocol")
->withDescription("Protocol used to communicate with brokers")
->withAllowableValues<std::string>({SECURITY_PROTOCOL_PLAINTEXT, SECURITY_PROTOCOL_SSL, SECURITY_PROTOCOL_SASL_PLAINTEXT, SECURITY_PROTOCOL_SASL_SSL})
Copy link
Member

Choose a reason for hiding this comment

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

When looking at PublishKafka.cpp:686, it seems like only SECURITY_PROTOCOL_SSL is actually supported, and the default empty value is interpreted as plaintext.

I suggest restricting the set of "allowable values" to plaintext and ssl, and handling plaintext near PublishKafka.cpp:687. I think doing nothing is a valid handling of plaintext.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When looking at PublishKafka.cpp:686, it seems like only SECURITY_PROTOCOL_SSL is actually supported, and the default empty value is interpreted as plaintext.

Should I leave the unused defines in? If it doesn't breaks backward compatibility removing them would make the code a bit clearer.

I suggest restricting the set of "allowable values" to plaintext and ssl, and handling plaintext near PublishKafka.cpp:687. I think doing nothing is a valid handling of plaintext.

What's the suggested coding style in this case? Having an empty else if (value == SECURITY_PROTOCOL_PLAINTEXT) branch or just using else if (value != SECURITY_PROTOCOL_PLAINTEXT) to handle unexpected values?

I would also add a default value for PLAINTEXT as we are trying to make the behaviour consistent with NiFi:
https://nifi.apache.org/docs/nifi-docs/components/nifi-docs/components/org.apache.nifi/nifi-kafka-2-0-nar/1.9.0/org.apache.nifi.processors.kafka.pubsub.PublishKafka_2_0/

Nifi also describes it as a required value. Should I add that too?

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Feel free to delete unused parts.
  2. Up to you. If you feel fancy, you can extend the property API to be able to return the allowable values and check against presence there.
  3. Yes. The more important thing is that we are compatible with NiFi configs, but compatibility in the other direction is probably nice to have.

@szaszm szaszm closed this in bdb52a2 Jan 5, 2021
@dam4rus dam4rus deleted the MINIFICPP-1440 branch January 6, 2021 17:20
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.

4 participants