[rules-users] Drools server => get a query result

jcp jepla at smile.fr
Wed Nov 16 05:46:17 EST 2011


Hi, i'm new to drools so excuse me if i'm asking newbie question.

For a project I insert via rest service a list of object to drools server,
in a stateless session - no need to use a stateful session.

The rules are fired and new objects are inserted.

ex : 
rule "1"
 when 
    $c : condition()
 then 
   insert(new FiredRule("my rule 1 fired", $c))
end

I also have a query who gets all the  FiredRule

query "get fired rules"
	firedRule : FiredRule()
end

My problem is that i can't get results from query when i'm in stateless
mode.
It works in stateful mode, but I need drools to work only with object I send
via rest service at time t. I don't want them store in in the knowledge base
and be reused for a future request.

I'm block here.
I send via json the batch-execution command with "insert-elements" and
"query" => "name":"get fired rules","out-identifier":"rules"
and I have an Exception when I set an out-identifier to "fire-all-rules"


11:26:00,552 ERROR [DefaultErrorHandler] Failed delivery for exchangeId:
949a5873-d146-4ad3-bc9c-d0dd9f7bbc81. Exhausted after delivery attempt: 1
caught: java.lang.NullPointerException
java.lang.NullPointerException
	at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:110)
	at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:32)
	at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155)
	at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76)
	at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:265)
	at
org.drools.camel.component.DroolsExecuteProducer.process(DroolsExecuteProducer.java:100)


When I test my case with java, I can get my query results, so I am led to
think that it is a problem on server side, maybe jars in the lib???
Or is it impossible to set an out-identifier for fire-all-rules in stateless
mode?.

Another consideration were to dispose each knowledgesession (on stateful
mode) when I send request to drools, but there is no command to do that,
only stop/restart server???


Subsidiary question : is it possible to add a System.out.println() in my
query??If yes, how to do it?

Thank you for your help

JC


--
View this message in context: http://drools.46999.n3.nabble.com/Drools-server-get-a-query-result-tp3512272p3512272.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list