Closed kanteshkm closed 5 years ago
Hi,
we are planning to use easy-rule in our project, we need to return value from a rule, below is the example:
SpELRule ageRule = new SpELRule() .name("Xpath rule") .description("XPath condition") .priority(1) .when(" #xpath1 == 'test' && #xpath2 == '2' && #xpath3 == '3' ") .then("#person.getValue(#xpath1)");
in the above rule, action will return a value [person.getValue()] and i need to return the value as response [it will be rest api, stateless]
is it possible to do return a value from matching rule?
thanks Kantesh
Please check Q2 in the FAQs section. Basically your rule should add a fact, then you can query the Facts object after rule execution to get the result.
Facts
Hi,
we are planning to use easy-rule in our project, we need to return value from a rule, below is the example:
SpELRule ageRule = new SpELRule() .name("Xpath rule") .description("XPath condition") .priority(1) .when(" #xpath1 == 'test' && #xpath2 == '2' && #xpath3 == '3' ") .then("#person.getValue(#xpath1)");
in the above rule, action will return a value [person.getValue()] and i need to return the value as response [it will be rest api, stateless]
is it possible to do return a value from matching rule?
thanks Kantesh