Metro Processors
Metro Processors can be used to create intermediate results of the processed FlowFiles that are to be used again later in a data flow. A distinction is made here between the GetMetro, PutMetro, MergeMetro and ExitMetro Processors, which are described below.
An application example of the Processors described can also be found in the section How-Tos under Metro.
PutMetro
FlowFiles can be cached with the PutMetro Processor.
A MetroLineController Service is required to configure the Processor, via which the Metro Processors communicate.
PutMetro Processors are also displayed differently to other Processors and therefore provide a better overview of the caching process.
GetMetro
The stored FlowFiles can be retrieved later in the data flow by a GetMetro-Processor.
Here it is important to select the same Metro-Controller that was used when the data was stored in the PutMetro-Processor.
In addition, the correlation attribute correlation
must be stored, which can be accessed via a dynamic property this can be created using a dynamic property.
An individual ID can be used as a value here, which can be used to distinguish FlowFiles within the Metro connection.
The following is an example of the intermediate storage and later retrieval of the data:
If the cached FlowFiles have already been retrieved by a GetMetro Processor, they are no longer available. This can result in errors during further access attempts. |
ExitMetro
If several PutMetro Processors are used for caching, ExitMetro Processors can also be used to obtain all FlowFiles available in the metro. No correlation attributes are required here, as the query does not refer to individual FlowFiles, but to all of t hem.
_One use case f_or the ExitMetro-Processor is when FlowFiles that are forwarded by many different Processors have to be handled in a common process (e.g. for error handling). in error handling). The simplest solution would be to route the matching relations (e.g. error relations) of all Processors to a single Processor, which takes over and initiates the higher-level process.
However, especially in complex flows, this can lead to too many long processes being drawn out and the flow overflowing. To work around this problem, use several PutMetro Processors and an ExitMetro Processor, for example, which transfers the FlowFiles to the Processor, which in turn handles the error handling.
MergeMetro
The MergeMetro Processor can be used to merge a FlowFile with one or more FlowFiles that have been temporarily stored by PutMetro Processors. The FlowFiles are matched using an attribute defined in the "Correlation Attribute Name" property.
To merge XMLs, it is easiest if the XML content does not contain an XML declaration. The desired declaration for the merged XML can be added via the "Header" property.
To merge JSON objects in a JSON array, you can set the "Header", "Footer" and "Demarcator" properties to [
, ]
and ,
respectively.