HCL Commerce Version 9.1.12.0 or later

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

Configure the development environment in which you will be creating your custom NiFi code. To setup the NiFi toolkit environment, see Custom NiFi processors.

Procedure

  1. 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.
  2. Open src\main\resources\META-INF\services\org.apache.nifi.processor.Processor, and add com.mycompany.CustomFieldDocumentProcessor.
  3. Build the root-bundle project.
    In the Project Explorer, right-click on the root (commerce-search-custom-bundle) and select Run As > Maven build.... (Note that there are two menu items, Maven build and Maven build... Choose Maven build....) The Edit Configuration window opens.
  4. Enter the command clean install -U -Denforcer.skip=true in the Goals field and click the Run button.
  5. Once the build is successful, the NAR file can be viewed in the target subdirectory of the commerce-custom-search-processors-nar project.
  6. Copy the NAR file from the commerce-custom-search-processors-nar project to a temporary directory on the host sever. For example: /root/TempNar.
  7. 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
  8. Restart the NiFi Docker container.

Results

Your custom processor is now ready to use.