Create and deploy a custom NiFi processor
In this lesson you create a custom NiFi processor. Doing this will enable you to to build connectors and customize the profit margin feature.
Before you begin
Procedure
- Create a new class called CustomFieldDocumentProcessor under the package com.mycompany in src/main/java folder of the commerce-custom-search-processors project located in the commerce-custom-search-bundle project. Copy the contents of CustomFieldDocumentProcessor.java to this class.
- Open src\main\resources\META-INF\services\org.apache.nifi.processor.Processor, and add com.mycompany.CustomFieldDocumentProcessor.
-
Build the root-bundle project.
In the Project Explorer, right-click on the root (commerce-search-custom-bundle) and select (Note that there are two menu items, Maven build and Maven build... Choose Maven build....) The Edit Configuration window opens.
- Enter the command clean install -U -Denforcer.skip=true in the Goals field and click the Run button.
- Once the build is successful, the NAR file can be viewed in the target subdirectory of the commerce-custom-search-processors-nar project.
- Copy the NAR file from the commerce-custom-search-processors-nar project to a temporary directory on the host sever. For example: /root/TempNar.
-
Copy the NAR file to the designated extension directory in the host server and
restart the NiFi Docker container.
docker cp commerce-custom-search-processors-nar-9.1.12.0.nar commerce_nifi_1:/opt/nifi/nifi-current/extensions
- Restart the NiFi Docker container.