RouteDocument
A processor that routes documents based on:
- Knowledge Discovery document metadata. The processor can read a metadata field that matches an XPath expression, and check whether a condition is true. The FlowFile is routed if the field value equals, contains, starts with, is greater than, is less than (and so on) a certain value.
- Document properties. The processor can route a document based on document properties such as the number of file or filename parts.
- Custom conditions. The processor accepts any valid expression in NiFi expression language.
Properties
| Name | Description |
|---|---|
| Routing Strategy |
Specifies how to route FlowFiles:
Any Flowfiles that are not routed to either a named relationship or "matched" are routed to the "unmatched" relationship. OpenText recommends that you use the advanced configuration interface to configure how FlowFiles are routed. Right-click the processor and click Advanced, and then follow the instructions on the GUIDED SETUP tab. |
Relationships
| Name | Description |
|---|---|
| property_name | FlowFiles that match a condition are routed to the specified output relationship. This applies when you choose the Routing Strategy "Route to Property name", in which case the processor has an output relationship for each condition that you create. |
| matched | FlowFiles that matched at least one ("Route to 'matched' if any matches") or all ("Route to 'matched' if all match") of the defined conditions, depending on the chosen Routing Strategy. This relationship does not exist when you choose "Route to Property name". |
| unmatched | FlowFiles that were not routed by the conditions that you defined. |
Example Configurations
The following image shows a configuration where:
- Documents where "field" has a subfield named "subfield" with a value greater than 721 are routed to the output relationship "FieldGreaterThan721". The "aggregator" has been set to "max", so if the XPath expression matches multiple fields, the processor only compares the highest value.
- Documents where "field2" equals "IDOL" are routed to the output relationship "Field2EqualsIDOL". The "aggregator" has been set to "first" so the processor only compares the first field that it finds.
- All other documents are routed to "unmatched".
The rules are evaluated in priority order (where the lowest number represents the highest priority). To change the priority, hover the mouse pointer over the priority value and click + or -:
The following image shows a configuration where the processor has only two output relationships - "matched" and "unmatched".
- Documents are routed to matched if they have at least one associated file with the MIME-type "image/jpeg", and the field "imageWidthPixels" is greater than or equal to 400.
- All other documents are routed to "unmatched".