Decisions provide a simpler model for executing rules, which can be published as a service for remote execution.
A Decision is an entry point into rule execution. It consists of a set of inputs, rules that execute against those inputs, and a set of outputs that reflect the result. Those inputs, outputs, and rules are author-defined, ultimately providing rule authors flexibility of shaping the input and output signature used during runtime execution.
Once authoring is complete, Decisions can be tested in irVerify and subsequently consumed by the Rule Execution Service for remote execution via a RESTful API.
Prerequisites
Before you get started, you'll need to make sure you have the following:
- For authoring and testing Decisions, irAuthor 5.5.0 or greater.
Adding a Decision
A Decision can be added from the Decisions navigation panel.
Every new decision contains a single Rule Set named 'DecisionStart'. Any rules added to that Rule Set will execute automatically when the that Decision is executed.
Additional explicit Rule Sets may be added to the Decision. These Rule Sets will execute only when called from the 'DecisionStart' Rule Set or from other Rule Sets within the same decision via the ExecuteRuleSet action. If an explicit Rule Set in a Decision is not explicitly called via ExecuteRuleSet, then that Rule Set will not execute.
Entity based Rule Sets can also be called from a Decision based rule set. This preserves the ability to author rules in the context of an Entity.
Editing a Decision
When a Decision is selected in the Decisions navigation panel, the irAuthor content panel displays the Decision editor.
Inputs and Outputs
Inputs and outputs may be added or removed using the add (+) and remove (X) buttons next to their data grids. When an input or output is added to the Decision, its 'Name' and 'Data Type' may be assigned. The Data Type may be any primitive data type InRule supports (Boolean, Data, DateTime, Decimal, Integer, Text), or an Entity previously authored in the Rule Application. An Entity input or output may be defined as an Entity Collection by checking the 'Is Collection' checkbox in the right-hand column.
Vocabulary
Authors can create a vocabulary that allows them to make rules that read like regular English. The vocabulary is a collection of English-language phrases, or more accurately, templates of English-language phrases, each connected to a value it will represent, or to an action it will take.Vocabulary may be authored by clicking the 'Create vocabulary' hyperlink at the bottom of the Decision editor. This allows business language vocabulary to be authored in the context of this Decision, which is available to Rules in any of its Rule Sets.
Rule Authoring
Rules and actions may be added to Decision Rule Sets the same way that they may be added to Entity Rule Sets or Independent Rule Sets.All Decision Rule Sets are confined to explicit fire mode. Any additional Rule Set added to the Decision may define parameters, however the 'DecisionStart' default Rule Set may not.
To learn about Execute Decision action, go here .
Testing a Decision
irVerify may be used to test a Decision.
Clicking the 'Test' button on the 'Home' tab will launch irVerify if the item selected in the navigation panel is a Decision or a Rule Set or Rule under a Decision. If the down arrow under the 'Test' button is clicked, a specific Decision may be selected from the drop-down menu.
Here, the input fields may be populated as if they were the values being input to the Decision.
Setting the output field values in irVerify is discouraged because this is not a scenario that would apply when executed as a Decision Service.
To execute the Decision, either click the 'Apply' button on the 'DecisionStart' Rule Set, or click the 'Apply Rules' button in the 'Home' tab.
The result of the Decision will be the values of the output fields.
Loading and saving state from a Decision is only supported via .testscenario files. To load XML/JSON into individual Entities, use the down arrow next to the 'New' button on Entity Fields/Collection Members to load/save state.
Executing a Decision
The irServer Rule Execution Service can execute Decisions either via the SOAP or REST endpoints.
See the irSDK developer documentation on how to execute Decisions:
-
Application Integration with InRule
- irServer® - Rule Execution Service
- Executing a Decision on irServer SOAP endpoint using a Service Reference
- Execute Decision Sample Request and Response Formats
- irServer® - Rule Execution Service
-
Source Code Examples
- Runtime API Examples
- Executing Rules
- Executing Decisions
- Executing Rules
- Runtime API Examples
For more information see the article, Execute Decision.
Comments
0 comments
Please sign in to leave a comment.