Skip to content

NIFI-10500: Improved property ordering in MQTT processors#6417

Closed
turcsanyip wants to merge 2 commits intoapache:mainfrom
turcsanyip:NIFI-10500
Closed

NIFI-10500: Improved property ordering in MQTT processors#6417
turcsanyip wants to merge 2 commits intoapache:mainfrom
turcsanyip:NIFI-10500

Conversation

@turcsanyip
Copy link
Contributor

@turcsanyip turcsanyip commented Sep 14, 2022

Summary

NIFI-10500

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

@nandorsoma nandorsoma left a comment

Choose a reason for hiding this comment

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

Thank you for your changes, @turcsanyip. I've found a few minor things that could be improved. Could you check them?

PROP_TOPIC,
PROP_RETAIN,
PROP_QOS,
RECORD_READER,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably put reader/writer properties to the end of the list to keep the mqtt related properties together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are 2 main principles when ordering properties:

  • properties with higher importance / being used frequently should come first
  • keep related properties together

I believe the Timeout and Last Will properties are the least frequently used ones. Also, the by default visible Record properties may encourage their use. For these reasons I would keep this order even if those properties rather belong to the MQTT config. Record Writer has a similar position in the List* processors.

if ((readerIsSet && !writerIsSet) || (!readerIsSet && writerIsSet)) {
results.add(new ValidationResult.Builder().subject("Reader and Writer").valid(false)
results.add(new ValidationResult.Builder().subject("Record Reader and Writer").valid(false)
.explanation("both Record Reader and Writer must be set when used.").build());
Copy link
Contributor

Choose a reason for hiding this comment

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

Rendered text on the UI looks like "Record Reader and Writer is invalid, because both Record Reader and Writer must be set when used." which is a bit verbose. I'd remove the reference to "Record Reader and Writer" from the explanation to make the description simpler.

.name("add-attributes-as-fields")
.displayName("Add attributes as fields")
.description("If using the Records reader/writer and if setting this property to true, default fields "
.description("If using the Record Reader/Writer and if setting this property to true, default fields "
Copy link
Contributor

Choose a reason for hiding this comment

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

Because of the dependsOn property, the first if will always be true. I'd remove it to make the description simpler.

PROP_GROUPID,
PROP_TOPIC_FILTER,
PROP_QOS,
PROP_MAX_QUEUE_SIZE,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put this property to the end of the list (before reader/writers if you accept that comment) because this property is not strictly related to the MQTT client itself as the other properties around it.

Copy link
Contributor

@nandorsoma nandorsoma left a comment

Choose a reason for hiding this comment

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

Thanks @turcsanyip, LGTM!

@arpadboda
Copy link
Contributor

Merged in 5303aad

@arpadboda arpadboda closed this Sep 14, 2022
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.

3 participants