<div dir="ltr"><div><div><div><div><div><div><div>Hello, <br><br></div>I am a little bit confused as I don&#39;t get what I am doing wrong. Here is my rule: <br><br>**************************<br>rule &quot;Exchange Pattern&quot;<br>

    when<br>        $p2: ProcessAdapter()<br>        $mainProcess: ProcessAdapter( isMainProcess(), this!=$p2)<br>        MessageFlowAdapter ( fromProcess == $mainProcess, toProcess==$p2)<br>        MessageFlowAdapter ( fromProcess == $p2, toProcess==$mainProcess)<br>

        exists ItemAwareElementAdapter( ) from $mainProcess.getReceivedResources($p2)<br>        exists ItemAwareElementAdapter( ) from $mainProcess.getGivenResources($p2)        <br>    then<br>        System.out.println(&quot;** FOUND EXCHANGE PATTERN betwwen &quot;+$mainProcess.getParticipant().getName()+&quot; AND &quot;+$p2.getParticipant().getName());<br>

        System.out.println(&quot;Given: &quot;+$mainProcess.getGivenResources($p2)+$mainProcess.getGivenResources($p2).size());<br>        System.out.println(&quot;Received: &quot;+$mainProcess.getReceivedResources($p2)+$mainProcess.getReceivedResources($p2).size());<br>

        System.out.println(&quot;Intersection: &quot;+$mainProcess.intersectGivenAndReceivedResourcesWithProcess($p2)+$mainProcess.intersectGivenAndReceivedResourcesWithProcess($p2).size());<br>end<br>**************************<br>

<br></div>This rule is never fired, although I know it should. <br><br></div>When I comment out the ONE OF the two &quot;exists&quot; constraints, I get this output: <br><br>**************************<br>** FOUND EXCHANGE PATTERN betwwen Amazon AND Ship.Comp.<br>

Given: [Products (ID:DataObjectReference_2)]1<br>Received: [Products (ID:DataObjectRefeference_GEN7)]1<br>Intersection: [Products (ID:DataObject_2)]1<br>**************************<br><br></div>From the output you can see that the rule should have been fired with the two &quot;exists&quot; constrains as both conditions are met, but it doesn&#39;t. <br>

</div>I am kind of new to Drools so I may be doing an horrible mistake but google haven&#39;t been my friend so far. Any help will be very appreciated!<br><br></div>Thanks. <br></div>Anis<br></div>