Open ktalebian opened 3 years ago
If you are using something like Spring Boot to accept the HTTP request then you can just create your RuleBook as a Bean and Autowire it into your Controller.
Check out this example: https://github.com/deliveredtechnologies/rulebook/tree/develop/rulebook-examples/helloworld-spring-web
@Clayton7510 I'm not sure how this applies to my original question. The rule itself needs to be async. In the link you provided, the when
condition is still sync https://github.com/deliveredtechnologies/rulebook/blob/develop/rulebook-examples/helloworld-spring-web/src/main/java/com/example/rulebook/helloworld/HelloSpringRule.java
Basically, instead of
@When
public boolean when() {
return hello != null;
}
I need
@When
public CompletionStage<boolean> when() {
return getRequest().thenApply(result => result != null);
}
How do you create a role where the condition/evaluation is async? For example, I need to make a HTTP request to verify a fact and return the result.