Skip to content

NIFI-7534 Consume MQTT Processor. Support Expression Language for Topic Filter Property#4573

Closed
kpsngh1998 wants to merge 1 commit intoapache:mainfrom
kpsngh1998:nifi-7534
Closed

NIFI-7534 Consume MQTT Processor. Support Expression Language for Topic Filter Property#4573
kpsngh1998 wants to merge 1 commit intoapache:mainfrom
kpsngh1998:nifi-7534

Conversation

@kpsngh1998
Copy link
Contributor

@kpsngh1998 kpsngh1998 commented Oct 6, 2020

NIFI-7534 Consume MQTT Processor. Support Expression Language for Topic Filter Property

Thank you for submitting a contribution to Apache NiFi.

Please provide a short description of the PR here:

Description of PR

Added variable registry expression language support for Topic Filter property.
Note: Flowfile attribute expression lanuguage support is not added since evaluation is done in OnScheduled and no flowfile is available there.

Enables X functionality; fixes bug NIFI-7534.

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 NIFI-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? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • Have you verified that the full build is successful on JDK 8?
  • Have you verified that the full build is successful on JDK 11?
  • 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, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

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 for build issues and submit an update to your PR as soon as possible.

@pvillard31
Copy link
Contributor

Any reason for not using parameters?

@kpsngh1998
Copy link
Contributor Author

@pvillard31 Could you elaborate which parameters? Are you asking about parameters of evaluateAttributeExpressions() method? If yes, since possible parameters are related to Flowfiles and ConsumeMQTT don't have any incoming flowfile, so didn't use any parameter.

@pvillard31
Copy link
Contributor

On your process group, you can associate a parameter context where you can define your parameters. Parameters are referenced by using #{myParameter} in the property and parameters are supported everywhere (including sensitive properties and properties where expression language is not enabled). More details here: http://nifi.apache.org/docs/nifi-docs/html/user-guide.html#Parameters

@pvillard31
Copy link
Contributor

I'd also add that with the addition of this concept of parameters (as a far better replacement of the variables), expression language should only be set where it makes sense to call some EL functions or to reference attributes of incoming flow files. But I'm not sure this is required for this specific use case since it does not accept incoming connections. Having said that, your change is valid from a code point of view, so I can merge it if there is use case that requires it.

@kpsngh1998
Copy link
Contributor Author

Thanks for sharing info on parameters. Regarding EL usecase, I couldn't think of any atleast for MQTT source except only when you have topicName present in some registry file and you want to access it using EL. This jira was already raised so i picked it up as my first PR.

@pvillard31
Copy link
Contributor

That's fine, it's not causing any issue and could be useful for people not willing to move to parameters right away. But going forward we really want to have people using Parameters instead of Variables.

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 contribution @kpsngh1998

@asfgit asfgit closed this in a95ffce Oct 8, 2020
thenatog pushed a commit to thenatog/nifi that referenced this pull request Oct 9, 2020
…ic Filter property

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#4573.
thenatog pushed a commit to thenatog/nifi that referenced this pull request Oct 20, 2020
…ic Filter property

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#4573.
driesva pushed a commit to driesva/nifi that referenced this pull request Mar 19, 2021
…ic Filter property

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#4573.
adenes pushed a commit to adenes/nifi that referenced this pull request Jul 5, 2021
…ic Filter property

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#4573.
krisztina-zsihovszki pushed a commit to krisztina-zsihovszki/nifi that referenced this pull request Jun 28, 2022
…ic Filter property

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes apache#4573.
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