HCL Commerce Version 9.1.10.0 or later

Modify groovy script in processor to accommodate NRT indexing

This section of the tutorial explains the steps to modify the groovy script in the processor to accommodate Near Real Time (NRT) indexing for Profit Margin customization.

Procedure

Perform the following steps to modify the Groovy Script in the auth.product– ProfitMarginDatabaseConnectorPipe process group present in auth.product connector.
  1. Double-click auth.product- ProfitMarginDatabaseConnectorPipe and go to Custom Connector Pipe > Custom Connector Pipe Processor
  2. Right-click CustomerConnectorPipeProcessor and click View configuration.
  3. Click STOP & CONFIGURE on the top-right corner of the Processor Details screen.
  4. Go to Properties Tab and copy the contents from Value column of the Script Body.
  5. Paste this copied script in a text editor and find the below line of Code.
    final String index = "." + environment.toLowerCase() + "." + store + ".product." + time;
  6. Edit the line to comment it out by adding two forward slash // in the beginning of the code as shown below.
    // final String index = "." + environment.toLowerCase() + "." + store + ".product." + time;
  7. Similarly, find the below line of code in the same script.
    final String language = flowFile.getAttribute("param.langId");
  8. Paste the below code-block after the above mentioned code line.
    String index = null;
    		String flowNRT = flowFile.getAttribute("flow.NRT");
    		if ("true".equals(flowNRT)) {
    			index = environment.toLowerCase() + "." + store + ".product";
    		} else {
    			index = "." + environment.toLowerCase() + "." + store + ".product." + time;
    	}
    Note: The pipe used in the connector, already has the full auth index created and does not need the time parameter to refer to the auth indices.
  9. Copy this newly edited modified script and paste it in the Value column of the Script Body.
  10. Click Apply.
  11. Right-click the CustomerConnectorPipeProcessor again and click Start to restart the processor.
    Note: If the CustomConnectorPipeProcessor displays an invalid state as shown in the below image then do the following:

    HCL Commerce Version 9.1.9.0 or later
    1. Right-click the CustomerConnectorPipeProcessor and click Configure.
    2. Select the Success checkbox in the Settings tab and then click Apply.
    3. Restart the processor again.
    HCL Commerce Version 9.1.11.0 or later
    1. Right-click the CustomerConnectorPipeProcessor and click Configure.
    2. Navigate to the Relationships tab.
    3. Click the Terminate checkbox, under the Success.
    4. Restart the processor again.