Hi guys,<br><br>I&#39;m trying drools-fusion&#39;s cep capabilities but I&#39;m having some troubles on loading the data to the Working Memory. I have three types defined in the DRL File: Customer, POS (Point of sale) and Transaction (event). I have a rule to discover suspicious transactions (customers that have made two transactions in ten seconds and from diferents POS).<br>
<br>Besides, I have other 3 helper rules that receive the fact (Customer or POS) or the event (Transaction) in JSON format, convert it and store it in the session (Customer or POS) or forward the event to another entry-point.<br>
<br>My drools file:<br><br>global org.codehaus.jackson.map.ObjectMapper jsonConverter;<br><br>declare Event<br>    @role(event)<br>    id : String<br>    logicNumber : String<br>    customer : String   <br>end<br><br>declare POS<br>
    logicNumber : String   <br>end<br><br>declare Customer<br>    id : String   <br>end<br><br>rule &quot;rule_convertAndInsertPOS&quot;<br>    when<br>        $json : String() from entry-point convertAndInsertPOS<br>    then<br>
        POS pos = jsonConverter.readValue($json, POS.class);<br>        retract($json);<br>        insert(pos);<br>    end<br>    <br>rule &quot;rule_convertAndInsertCustomer&quot;<br>    when<br>        $json : String() from entry-point convertAndInsertCustomer<br>
    then<br>        Customer customer = jsonConverter.readValue($json, Customer.class);<br>        retract($json);<br>        insert(customer);<br>    end    <br><br>rule &quot;rule_convertAndSendEvent&quot;<br>    when<br>
        $json : String() from entry-point convertAndSendTransaction<br>    then<br>        Event evt = jsonConverter.readValue($json, Event.class);<br>        System.out.println(&quot;Repassando evento &quot; + evt);<br>        entryPoints[&quot;StreamTransactions&quot;].insert(evt);<br>
        retract($json);<br>    end<br><br>rule &quot;rule_suspiciousTransactionInDifferentsPOSOfSameCustomer&quot;<br>    dialect &quot;mvel&quot;<br>    when<br>        $pos : POS($posNumber : logicNumber)<br>        $customer : Customer($idCustomer : id)  <br>
        $trans1 : Event(logicNumber == $posNumber, customer == $idCustomer) from entry-point StreamTransactions<br>        $trans2 : Event(logicNumber != $posNumber, customer == $idCustomer, this after[0, 10s] $trans1) from entry-point StreamTransactions<br>
    then        <br>        System.out.println(&quot;Suspect fraud between the transactions &quot; + $<a href="http://trans1.id">trans1.id</a> +  &quot; and &quot; +  $<a href="http://trans2.id">trans2.id</a>);<br>    end    <br>
<br>In my test case, before starting sending events to the entry-point &quot;convertAndSendTransaction&quot;, I try to load some POS and Customers.<br><br>    private void loadPOS() {<br>        WorkingMemoryEntryPoint entryPointConvertAndInsertPOS = kSession<br>
                .getWorkingMemoryEntryPoint(&quot;convertAndInsertPOS&quot;);<br>        log(&quot;Loading POS&quot;);<br>        for (int i = 1; i &lt;= 20000; i++) {<br>            if ((i % 1000) == 0) {<br>                log(&quot;Inserting POST &quot; + i);<br>
                kSession.fireAllRules();<br>            }<br>            entryPointConvertAndInsertPOS.insert(getPOSInJson(&quot;POS&quot; + i));<br>        }<br>        kSession.fireAllRules();<br>        log(&quot;POS loaded&quot;);<br>
    }<br><br>    private void loadCustomer() {<br>        WorkingMemoryEntryPoint entryPointConvertAndInsertCustomer = kSession<br>                .getWorkingMemoryEntryPoint(&quot;convertAndInsertCustomer&quot;);<br>        for (int i = 1; i &lt;= 10000; i++) {<br>
            if ((i % 1000) == 0) {<br>                log(&quot;Inserting customer &quot; + i);<br>                kSession.fireAllRules();<br>            }<br>            entryPointConvertAndInsertCustomer.insert(getCustomerInJson(String.valueOf(i)));<br>
        }<br>        kSession.fireAllRules();<br>        log(&quot;Customers loadaed&quot;);<br>    }<br><br clear="all">No matter if I call loadPOS() or loadCustomer() first, the first one I call is executed correctly, but when I call the second one it stops on fireAllRules() and the memory increases untill OME.If I remove the rule &quot;rule_suspiciousTransactionInDifferentsPOSOfSameCustomer&quot; from the DRL file, both the loading executes correctly. It seems that the when the data is inserted into the session, the begin of this rule is being executed or something like that.<br>
<br>How can I solve this issue?Is there any way of just executing the rules of loading data at this moment?Is there a better way to achieve what I&#39;m trying?<br><br><br>The full project (maven) is attached to this email.<br>
<br><br>Thanks and sorry for the English.<br>-- <br>Luciano Davoglio Molinari<br><a href="http://lucianomolinari.wordpress.com/">http://lucianomolinari.wordpress.com/</a><br>