1
votes

I got from my Apache Kafka the following flowfile content and my goal is to split this data into different attributes.

e.g. date distance etc

and then convert this attributes Json (I know which processor, I need for that)

but I dont know, how which Nifi Processor I need for the splitting functionality and how the configuration should look like

Example content

2016-09-08 16:40:32.215|39|11|Jamie Engesser|1594289134|Memphis to Little Rock Route 2|Normal|40.76|-88.77|1000 Cancel

1

1 Answers

3
votes

If each input flowfile is a single-line record, you might use a flow like this:

  1. ExtractText - to extract a single text record into an attribute. This might be as simple as adding a custom property "line" with the regex (.*) using the default line settings.
  2. UpdateAttribute - to parse individual fields out of the line into separate attributes. The getDelimitedField function in NiFi expression language would be useful here. For example, ${line:getDelimitedField(1, "|")} to get the date, ${line:getDelimitedField(6, "|")} for the route "Memphis to Little Rock Route 2".