1-5 Handling Multiple Types of Content
If you have more than one type of content that you want to handle in a single flow, there are a few ways to do it.
Method 1:
Use either EvaluateXPath or EvaluateJsonPath to test for the first type of content. The "matched" relationship will route the matching content, "unmatched" will have content of the same type (XML/JSON) but which does not contain the specified path and the "failure" relationship will route content that is not of that type. In the example below, we route both the "unmatched" and "failure" relationships of EvaluateXPath to the EvaluateJsonPath processor.
Method 2:
Use the IdentifyMimeType processor to store the MIME type as a property, then use the RouteOnAttribute processor to send the content to separate XML and JSON handlers.
Method 3:
If file extensions are reliable, use RouteOnAttribute with route properties on filename property. e.g. XML: ${filename:endsWith('.xml')}. Flow is the same as Method 2 except that IdentityMimeType can be removed and GetFile connected directly to RouteOnAttribute.
Method 1
Download Template
Processors:
GetFile
– reads files from a watched directory
Properties
Input Directory: /some/path
RouteOnAttribute
– allows for creation of custom routes based on properties, such as mime.type
Properties
ml.uri: /messages/${ml.xml.id}.xml
(custom property)