此内容没有您所选择的语言版本。
17.12. Using Stateful and Stateless RuleSessions
Procedure 17.3. Task
- Get the runtime by accessing the RuleServiceProvider as shown:
RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime();
RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To create a rule session, use one of the two RuleRuntime public constants. These are "RuleRuntime.STATEFUL_SESSION_TYPE" and "RuleRuntime.STATELESS_SESSION_TYPE", accompanying the URI to the RuleExecutionSet you wish to instantiate a RuleSession for.
- Optionally, access the properties to specify globals.
- The createRuleSession(...) method will return a RuleSession instance. You should cast it to StatefulRuleSession or StatelessRuleSession:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - When using a StatelessRuleSession, you can only call executeRules(List list) passing a list of objects, and an optional filter, the resulting objects are then returned:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow