Help : How to execute CoRRuleBook rules using SpringAwareRuleBookRunner
asasisekar opened this issue · 2 comments
asasisekar commented
Hi,
We have defined the rules by extending the CoRRuleBook as below and created the bean using SpringAwareRuleBookRunner. When executing the rule, results are set as null. Within the CoRRuleBook, results was set as expected but AbstractRuleBookRunner was not considering the results.
public class TestRuleBook extends CoRRuleBook<String> {
@Override
public void defineRules() {
addRule(
RuleBuilder.create()
.withFactType(ValidationRequest.class)
.withResultType(String.class)
.when(InsertIdRuleBook::isInvalid)
.then((facts, result) -> result.setValue("Invalid")))
.build());
}
}
@Configuration
public class ApplicationConfig {
@Bean
RuleBook testRuleBook() {
return new SpringAwareRuleBookRunner(
TestRuleBook.class, "package name");
}
}
Is SpringAwareRuleBookRunner only supports the POJO rules? Is there a way to execute the CoRRuleBook rules using runner class?
Clayton7510 commented
Not with the runner class. The runner's function is to create a RuleBook from annotated pojo rules.
Clayton7510 commented
Did that response answer your question?