In order to apply the rules you have created, the business rule must be loaded into a Rules Engine plugin in a pipeline.
Note: For the purpose of this article, we will be using the HTTP Gateway and Webhooks Connector plugins as examples.
To load the business rule in the Rules Engine plugin, perform the following steps.
- Navigate to Pipeline Studio then create a new pipeline.
- Locate the following plugins then drag and drop the plugins onto the design canvas as shown from the example below:
- HTTP Gateway
- Rules Engine
- Webhooks Connector
- Configure each plugin by providing the required details.
Note: For more information on how to configure a plugin, see Configuring Plugins in your Pipeline. - In configuring the Rules Engine plugin, select the business rule you want to use in filtering your incoming data. Note that upon selection, the exit ports for each rule included in the business rule will be displayed.
- After you have configured the plugins, connect them by dragging the output terminal of one plugin to the input terminal of another plugin. As there are three exit ports generated for the Rules Engine plugin based on the selected business rule, we will add two more Webhooks Connector to connect each exit port to the plugin we want our data to be sent after satisfying the rule, as shown from the example below:
- Click Save and Deploy to run the pipeline.
Sample Implementation
Using the following rules from the Business Rule ABC selected in the Rules Engine plugin as basis, send a sample incoming data to the pipeline.
- Rule 1: If location is not equal to tempdata[0], and temp is less than 35, then send the data to Exit_A.
- Rule 2: If location is equal to tempdata[0], or tempdata[1] is greater than 35, then send the data to Exit_B.
- If both rules are not met, then send the data to default exit: Exit_X.
For the purpose of this article, we will be using Postman in sending sample incoming data to the HTTP Gateway plugin. Refer to the online help of the HTTP Gateway plugin for more information on how to use this plugin.
- Open Postman then enter the data to be sent to the HTTP Gateway in JSON format as shown from the sample screenshot below:
Note: The incoming data must contain all the field names and data types used in your business rule. - Click Send to send the data to the HTTP Gateway.
Verify Data
To verify if the data was received by the plugin and was checked against the rules from Business Rule ABC, go to the Logs tab of the Rules Engine plugin.
As you can see from the screenshot above, the Rules Engine plugin successfully received the data sent from the HTTP Gateway plugin, as well as checked the data against the business rule selected in the plugin (Business Rule ABC) and identified that only the conditions from Rule 1 was satisfied by the incoming data. Therefore, sending the data to Exit A only.
In order to also verify that the Webhooks A plugin connected to Exit A port received the data from the Rules Engine plugin, a log should be displayed in the plugin’s Logs tab as shown from the screenshot below:
If The Business Rules Were Modified
If an in-use Business Rule was modified, the Rules Engines using it need to be restarted, in order for them to load the modified Rules.
Note: A planned update to this feature will enable automatic restarts of Rules Engines when the Business Rules they use are modified, rendering the instructions here unnecessary.
To restart a Rules Engine, load the deployed pipeline (do not go into Edit mode), and double-click on the Rules Engine to view its details. The plugin detail panel appears.
On the top right corner of the plugin, click on the "Restart" button. The plugin will now restart, with the updated Business Rules loaded.
Back to Top | < Previous | Next > |
Comments
0 comments
Please sign in to leave a comment.