In quarkus kogito, the rules(decision table) are picked from xls file in resources folder.
I want to store the decision table in a database and the load the decision table from there.
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/credit")
public class CreditResource {
```
@Inject
KieRuntimeBuilder runtimeBuilder;
@POST
@Produces(MediaType.TEXT_PLAIN)
public Boolean getCredit(Person p) {
String drl = ""; //assume that string drl holds what is returned from the database
KieServices kieServices = KieServices.Factory.get();
KieFileSystem kfs = kieServices.newKieFileSystem();
kfs.write( "src/main/resources/org/acme/person-rules.xls",
kieServices.getResources().newReaderResource( new StringReader(drl) ) );
kieServices.newKieBuilder( kfs ).buildAll();
KieSession ksession = runtimeBuilder.newKieSession();
ksession.insert(p);
ksession.fireAllRules();
return p.isApproved();
}
}
- List item
POJO of Person with fields: amount, credit, existing loan, approved.
But this doesn't seem to work as no rules are being fired when
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…