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

Reply via email to