rest - Drools - Response XML from multiple rule execution -


i have below 2 rules:

global response myresponse;  rule "rule1"     when         loan(processid == "1")             myresponse.setruleid("rule1");         myresponse.setpmtstatus("valid"); end  rule "rule2" when     loan(amount > 1000)     myresponse.setruleid("rule2");     myresponse.setpmtstatus("invalid"); end 

when access drools through rest sending below request xml, according data inserted, both rules should fire.

<batch-execution lookup="testsession">   <set-global identifier="myresponse" out-identifier="response">       <com.sample.response></com.sample.response>   </set-global>    <insert out-identifier = "loan">     <com.sample.loan>       <loanid>11112222</loanid>       <processid>1</processid>       <amount>2000.00</amount>    </com.sample.loan>   </insert>  <fire-all-rules/> </batch-execution> 

in response xml, receive consequence information both rules. example, 1 response node ruleid = rule1 , pmtstatus = valid, , node ruleid=rule2 , pmtstatus = invalid.

right now, getting results rule executed last. please advise how should make request in order receive results fired rules in return xml.

thanks

if number of rules limited 2 , won't scale in future can have 2 global response objects created each of rule respectively. or else can pass list object reference drl file.

rule "rule1" when     loan(processid == "1")     $list: arraylist<response>     myresponse:response()     myresponse.setruleid("rule1");     myresponse.setpmtstatus("valid");     $list.add(myresponse); 

end


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -