You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Michael W Moser (Jira)" <ji...@apache.org> on 2023/02/01 17:49:00 UTC
[jira] [Commented] (NIFI-11121) If/Else/Switch processor
[ https://issues.apache.org/jira/browse/NIFI-11121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17683112#comment-17683112 ]
Michael W Moser commented on NIFI-11121:
----------------------------------------
Hi [~joshm] , have a look at the RouteOnAttribute and RouteOnContent processors. They use dynamic properties that you add to the processor to create new output relationships.
For a RouteOnAttribute example, you would create a new property called "color red" with the value ${colorAttr:equalsIgnoreCase('red')} and a property called "color blue" with the value ${colorAttr:equalsIgnoreCase('blue')}. You can then configure RouteOnAttribute to handle different routing scenarios using its Routing Strategy property.
> If/Else/Switch processor
> ------------------------
>
> Key: NIFI-11121
> URL: https://issues.apache.org/jira/browse/NIFI-11121
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Josh McCullough
> Priority: Major
> Labels: processor, suggestion
>
> I'm a new user but I've already found it difficult to perform some logical operations e.g. "if X then Y else Z" or a switch option. I'm not sure if it's easy or hard to implement but let's consider a "switch" processor, here's how I think it would work...
> {code}
> ... -- <some relationship> --> [Switch] -- <relationship1> --> [next processor]
> | | \---- <relationship2> --> [next processor]
> | \------ ...
> \-------- <relationshipN> --> [next processor]
> {code}
> In the properties for this process you could add parameters for each "case":
> * Param Name: {{color is red}}
> * Param Value: {{${colorAttr.equals('red')}}
> And additional cases for green/blue/etc. Which ever case results in `true` is the one that's chosen to follow. So the outgoing relationships would be: `color red`, `color green`, `color blue`.
> Each case, when followed, would pass the incoming FlowFile along to the related relationship.
> I realize this would require the ability to have dynamic / non-static relationships defined for a processor -- not sure if this functionality already exists?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)