Monday 19 February 2018

Apache Nifi - III

In the third segment of the series on Apache Nifi, we will run the simple flow that we developed in the previous post. The simple flow consists of two processors and a connector as shown below:








Navigate to D:\source (and also D:\sink) folder and make sure it is empty as shown below:







We will run the PickFile processor by selecting it and right clicking and clicking on Start as shown below:

















Now, the red square will appear as a green triangle to indicate that the processor is running as shown below:







We will drop a file called employees.csv (from our earlier blogs. You can use any text file instead) into D:\source as shown below:









Note that this file is picked up by the simple flow as is shown below and is already in the queue between the two processors:







Now, note that D:\source no longer has the file as shown below:







We can inspect the simple flow while the file is in transit by right clicking on the PickFile processor and clicking on View data provenance as shown below:











On the Nifi Data Provenance window, click on i as shown below:

















On the Provenance Event window that comes up, click on CONTENT tab. You can either download the file or view the file as shown below:



















Now, in the same way, we can inspect the file in the queue by right clicking on connector and then List Queue as shown below:











Then, on the success window, note that the file name and size are mentioned. Click on i as in the previous case to see the file content:









On the FlowFile, you can see the file name and size and also the download option:



















Click on DOWNLOAD to save the file and drop it into D:\InTransit folder for reference:















Then, click on OK button and X on right top on success window to return to the flow and enable the DropFile processor:








Then, navigate to D:\sink folder to see the file:










Thus, the file was picked from D:\source folder and dropped into D:\sink folder. We can stop the processors by right clicking anywhere on the canvas and clicking on Stop as shown below:













This step concludes the running on the simple flow in Apache Nifi