SplitToFields¶
This formatter splits data into an array by using the given delimiter and stores it at the metadata key denoted by Fields.
Parameters¶
Delimiter (default: ,)
Defines the delimiter to use when splitting the data. By default this parameter is set to “,”
Fields
Defines a index-to-key mapping for storing the resulting list into Metadata. If there are less entries in the resulting array than fields, the remaining fields will not be set. If there are more entries, the additional indexes will not be handled. By default this parameter is set to an empty list.
Parameters (from core.SimpleFormatter)¶
Source
This value chooses the part of the message the data to be formatted should be read from. Use “” to target the message payload; other values specify the name of a metadata field to target. By default this parameter is set to “”.
Target
This value chooses the part of the message the formatted data should be stored to. Use “” to target the message payload; other values specify the name of a metadata field to target. By default this parameter is set to “”.
ApplyTo
Use this to set Source and Target to the same value. This setting will be ignored if either Source or Target is set to something else but “”. By default this parameter is set to “”.
SkipIfEmpty
When set to true, this formatter will not be applied to data that is empty or - in case of metadata - not existing. By default this parameter is set to false
Examples¶
This example will split the payload by “:” and writes up to three elements as keys “first”, “second” and “third” as fields below the field “values”.
ExampleProducer:
Type: proucer.Console
Streams: console
Modulators:
- format.SplitToFields:
Target: values
Delimiter: ":"
Fields: [first,second,third]