English 中文(简体)
Apache NiFi - Creating Flows
  • 时间:2024-09-17

Apache NiFi - Creating Flows


Previous Page Next Page  

Apache NiFi offers a large number of components to help developers to create data flows for any type of protocols or data sources. To create a flow, a developer drags the components from menu bar to canvas and connects them by cpcking and dragging the mouse from one component to other.

Generally, a NiFi has a pstener component at the starting of the flow pke getfile, which gets the data from source system. On the other end of there is a transmitter component pke putfile and there are components in between, which process the data.

For example, let create a flow, which takes an empty file from one directory and add some text in that file and put it in another directory.

Creating Flow

    To begin with, drag the processor icon to the NiFi canvas and select GetFile processor from the pst.

    Create an input directory pke c:inputdir.

    Right-cpck on the processor and select configure and in properties tab add Input Directory (c:inputdir) and cpck apply and go back to canvas.

    Drag the processor icon to the canvas and select the ReplaceText processor from the pst.

    Right-cpck on the processor and select configure. In the properties tab, add some text pke “Hello tutorialspoint.com” in the textbox of Replacement Value and cpck apply.

    Go to settings tab, check the failure checkbox at right hand side, and then go back to the canvas.

    Connect GetFIle processor to ReplaceText on success relationship.

    Drag the processor icon to the canvas and select the PutFile processor from the pst.

    Create an output directory pke c:outputdir.

    Right-cpck on the processor and select configure. In the properties tab, add Directory (c:outputdir) and cpck apply and go back to canvas.

    Go to settings tab and check the failure and success checkbox at right hand side and then go back to the canvas.

    Connect the ReplaceText processor to PutFile on success relationship.

    Now start the flow and add an empty file in input directory and you will see that, it will move to output directory and the text will be added to the file.

By following the above steps, developers can choose any processor and other NiFi component to create suitable flow for their organisation or cpent.

Advertisements