FlowFilePolicyProcessor
A processor that modifies or routes FlowFiles based on custom policies that you define.
The processor takes a FlowFile from the input and you should use the transfer-flowfile or remove-flowfile policies to either route or discard the FlowFile.
The processor has an implied with-flowfile policy at the root of the policy definition. Any policy that requires a FlowFile can therefore be used without an explicit with-flowfile parent policy.
Properties
Name | Default Value | Description |
---|---|---|
IDOL License Service |
An IdolLicenseServiceImpl that provides a way to communicate with an IDOL License Server. |
|
Policies Class Path | The processor can be extended with additional functionality. Use this parameter to specify the path of additional policy classes. | |
Policies JSON | ${idol.repository.storage.dir}/policies.json | The path of a file containing the policy definition in JSON format. Use the advanced configuration interface to build your policies, or set this value to a JSON file that contains pre-configured policies. For information about how to build policies, see Build Policies. |
Output relationships | success,failure | A comma separated list of output relationship names. You can add as many output relationships as you need, and your policies can route FlowFiles to those relationships. |
Relationships
The output relationships for this processor are determined by the value of the "Output relationships" property.
Build Policies
To build policies, use the advanced configuration interface. To open the advanced configuration interface, right-click the processor and click Configure. Then, after the Configure Processor dialog box opens, click Advanced.
To build your policy, click . The following menu appears:
The options that are available depend on context. The image above shows all of the possible options. From left to right, these are:
- Edit - Opens a dialog so that you choose the policy class to use, enter simple values, or edit the policy JSON.
- Insert above - Insert a policy or value above the selected item. In many cases a list or a sequence of policies is allowed - where a single result value is required this is taken from the last entry.
- Insert below - Insert a policy or value below the selected item.
- Toggle advanced parameters - Some policies have advanced options which are hidden by default.
- Delete - Delete this policy or value.
- Close - Close the menu.
The following image shows a complete policy definition that routes FlowFiles. If a FlowFile doesn't have the attribute "idol.type" then it is routed to the "failure" relationship. Otherwise, FlowFiles equal to or greater than 1048576 bytes are routed to a relationship named "large_flowfile". Smaller FlowFiles are routed to the relationship "success". Any relationships that you use in the policy definition must be defined by the processor property "Output relationships".
TIP: If the content is too wide, click the left-most column (policies >) to switch to a compact view.
To view the policy definition in JSON format, click the POLICIES JSON tab. Each JSON object represents a policy class and its configuration. Any changes that you make in the visual editor are automatically applied to the JSON. If you make changes in the JSON view, click SAVE before using the visual editor again.
{ "policies": [ { "type": "if", "condition": { "type": "has-flowfile-attribute", "name": "idol.type" }, "then": { "type": "if", "condition": { "type": "less-than", "left": { "type": "get-flowfile-size" }, "right": 1048576 }, "then": { "type": "transfer-flowfile", "relationship": "success" }, "else": { "type": "transfer-flowfile", "relationship": "large_flowfile" } }, "else": [ { "type": "set-flowfile-attribute", "name": "idol.exception", "value": "Input must be in document format" }, { "type": "transfer-flowfile", "relationship": "failure" } ] } ] }