Hi Dmitry,
I'd suggest to add RouteOnAttribute processor and add a custom property by
expected condition :
one property with name textxml (for example) and with value the EL you
suggested (it supposed that you have the mime type in one of the attribute
of your flow file)
property with name texthml (for example) and with value the EL
${mimetype:equals('text/html')}
then you will have two automaticcaly created relationship and one
"unmatched". It will answer your need.
Hope this helps,
Pierre
2016-03-24 21:29 GMT+01:00 Dmitry Goldenberg <[email protected]>:
> Hi,
>
> I'm looking for a 'best practice' to set up a conditional within a
> dataflow, based on some attribute(s).
>
> I want to express something like this:
>
> if ("mimetype" equals "text/xml") {
> route FlowFile to XmlProcessingSubflow
> } else if ("mimetype" equals "text/html") {
> route FlowFile to HtmlProcessingSubflow
> } else {
> route FlowFile to DefaultDocProcessingSubflow
> }
>
> How can I do this in NiFi? I'm looking at RouteOnAttribute but I can't
> quite grok the Routing Strategy:
>
> Route to Property name
> A copy of the FlowFile will be routed to each relationship whose
> corresponding expression evaluates to “true”.
>
> Route to ‘matched’ if all match
> Requires that all user-defined expressions evaluate to true for the
> FlowFile to be considered a match
>
> Route to ‘matched’ if any matches
> Requires that at least one user-defined expression evaluate to true for
> the FlowFile to be considered a match.
>
> The first option I'm quite confused about. Route to property? Where are
> the relationships I'd be routing to?
>
> The second option seems to be what I need. Presumably I can add a "New
> property" with the name "mimetype"; the value -- not sure. Perhaps this
> is ${mimetype:equals('text/xml')} ? But I already have "mimetype" in
> the property name. Should the expression be somewhat different?
>
> Subsequently, if this allows me to route to one subflow based on one
> value, how do I route based on a different value of the mimetype, e.g.
> "text/html", to another subflow?
>
> Thanks.
> - Dmitry
>
>
>
>