user1544128
user1544128

Reputation: 582

Return facts from remotely firing rules on Drools server

Hello I am new to Drools server and I am trying to understand if it is possible to:

1)send from the client the FireAllRulesCommand

2)write a rule's right hand side on the server that can send to the client (which sent the FireAllRulesCommand) a subset of the facts in the left hand side of the rules.

If I have understood correctly in this article the obtained response is the Person that was inserted with InsertObjectCommand and has nothing to do with firing of rule Print cat from a person. Is there a function that let me send fact from the server to the client?

How can after sending FireAllRulesCommand see for example which rules were fired?

Upvotes: 0

Views: 262

Answers (1)

laune
laune

Reputation: 31300

1) The referenced article, contains code where exactly this is demonstrated:

cmd.getCommands().add(new FireAllRulesCommand());

2) One method would be to define a global List and have RHS code add to that list those facts you want sent back to the client. There is a GetGlobalCommand just for that.

3) Seeing which rules were fired on a server isn't so easy since this requires the installtion of a listener. If you're willing to add code to your rules you can log rule execution in another global and retrieve this from the server.

(If you want to develop, do it locally, with Drools being embedded in a Java application.)

Upvotes: 1

Related Questions