5
votes

I'm using NiFi to get data from an Oracle database and put some of this data in Kafka (using the processor PutKafka). Example : if the attribute "id" contains "aaabb"

Is that possible in Apache NiFi? How can i do it?

2

2 Answers

11
votes

This should definitely be possible, the flow might be something like this...

1) ExecuteSQL or QueryDatabaseTable to get the data from the database, these produce Avro

2) ConvertAvroToJson processor to convert the Avro to Json

3) EvaluateJsonPath to extract the id field into an attribute

4) RouteOnAttribute to route flow files where the id attribute contains "aaabbb"

5) PutKafka to deliver any of the matching results from RouteOnAttribute

2
votes

To add on to Bryan's example flow, I wanted to point you to some great documentation that should help introduce you to Apache NiFi.

Firstly, I would suggest checking out the NiFi documentation. It is very good and should help a lot. In addition to providing details on each of the processors Bryan mentioned it also has general documentation for every type of user.

For a basic introduction to build a NiFi flow check out this video.

For example templates check out this repo. It's a has an excel file at it's root level which has a description and list of processors for each template.