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.
-
Double-click auth.product-
ProfitMarginDatabaseConnectorPipe and go to
-
Right-click CustomerConnectorPipeProcessor and
click View configuration.
-
Click STOP & CONFIGURE on the top-right
corner of the Processor Details screen.
-
Go to Properties Tab and copy the contents from
Value column of the Script
Body.
-
Paste this copied script in a text editor and find the below line of
Code.
final String index = "." + environment.toLowerCase() + "." +
store + ".product." + time;
-
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;
-
Similarly, find the below line of code in the same script.
final String language =
flowFile.getAttribute("param.langId");
-
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.
-
Copy this newly edited modified script and paste it in the
Value column of the Script
Body.
-
Click Apply.
-
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:
- Right-click the
CustomerConnectorPipeProcessor
and click Configure.
- Select the Success checkbox in the
Settings tab and then click
Apply.
- Restart the processor again.
- Right-click the
CustomerConnectorPipeProcessor
and click Configure.
- Navigate to the Relationships
tab.
- Click the Terminate checkbox, under
the Success.
- Restart the processor again.