Specify a Shared Domain

An RDL rulebase domain that is shared with a client application is called an appshared domain; an RDL rulebase may contain many appshared domains. For more information on appshared domains, see Rulebase Definition Language Fundamentals.

A Java client application should interact with only one appshared rulebase domain during an invocation of the executeRules() method. When a rulebase shares more than one domain with client applications, the Java client application must specify the domain for interaction.

The Java client application must identify the interaction domain to the inference engine. The JSR‑94 specification provides a convenient means for client application to do this when the rule session is being instantiated. The second parameter of createRuleSession() method, the propertiesMap parameter, can be used to specify the name of the appshared domain to be used by the client application.

To pass the properties map specifying the desired appshared domain to the rule session, create a Java Hashtable and add the AionRuleEngineProperties.RULE_INFERENCING_DOMAIN_NAME property to the table mapped to the name of the target appshared domain name.

Example

Hashtable sessionProps = new Hashtable();
sessionProps.put(AionRulesEngineProperties.RULEBASE_INFERENCING_DOMAIN_NAME,
   "domain-name");
StatefulRuleSession session = (StatefulRuleSession)runtime.createRuleSession(
  rulesetUri, sessionProps, RuleRuntime.STATEFUL_SESSION_TYPE);

For a stateful rule session, it is possible to select a different domain for each invocation of the executeRules() method. This can be achieved through combined use of the property AionRulesEngineProperties.RULEBASE_AUTO_PUSH_POP_DOMAIN with the value Boolean.TRUE and the setInferencingDomainName() method of CARuleExecutionSetMetadata (see Reset Rules and Switch Domains).

For more information regarding other AionRulesEngineProperties and how they can be accessed, see Access CA Technologies's Extended RuleExecutionSet and Rule Properties.

Note: Classes in the Java client application, which correspond to the rulebase level classes that are used by the interacting appshared domain, must properly wrap those rulebase level classes. For more information, see Rules for Constructing Java Classes. Noncompliance of those Java classes with these rules results in failure to establish the rule session or failure to add objects to the inference engine.