Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help : How to execute CoRRuleBook rules using SpringAwareRuleBookRunner #176

Open
asasisekar opened this issue Jan 1, 2020 · 2 comments

Comments

@asasisekar
Copy link

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
Copy link
Collaborator

Not with the runner class. The runner's function is to create a RuleBook from annotated pojo rules.

@Clayton7510
Copy link
Collaborator

Did that response answer your question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants