<br> Ouch. Bug. Would you please add a JIRA for that and a test case?<br><br> Thanks,<br> Edson<br><br><div class="gmail_quote">2009/10/29 richarda <span dir="ltr"><<a href="mailto:richard.ambridge@gmail.com">richard.ambridge@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Ok, I have found if I run in:<br>
conf.setOption( EventProcessingOption.CLOUD );<br>
it works..<br>
<br>
but in<br>
conf.setOption( EventProcessingOption.STREAM );<br>
<br>
i get Null for the object<br>
<br>
any idea why?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
richarda wrote:<br>
><br>
> Thanks for the continued help... but<br>
><br>
> ---<br>
> ArrayList<MessageAsEvent> a=new ArrayList<MessageAsEvent>();<br>
> MessageAsEvent a1=new MessageAsEvent(); a1.setSerial("serial123");<br>
> a1.setUuid("mesC:7"); a1.setId(888); a.add(a1);<br>
> MessageAsEvent a2=new MessageAsEvent(); a2.setSerial("serial123");<br>
> a2.setUuid("mesC:7"); a2.setId(889);a.add(a2);<br>
><br>
> ksession.setGlobal("hibernateSession", hibernateSession);<br>
> ksession.setGlobal("data", a);<br>
><br>
> ----<br>
><br>
> global java.util.ArrayList data;<br>
><br>
> rule "Repeating as signature"<br>
> when<br>
> $m : MessageAsEvent(uuid=="mesC:7")<br>
> $others : MessageAsEvent(uuid=="mesC:7", id!=$<a href="http://m.id" target="_blank">m.id</a>)<br>
> from data<br>
> then<br>
> System.out.println("++++++++++++Gathering in signatures m="+$m+"<br>
> data="+$others);<br>
> insert($others);<br>
> end<br>
><br>
> ----<br>
><br>
> and I still get;<br>
> Audit:-<br>
><br>
> <org.drools.audit.event.ActivationLogEvent><br>
> <type>4</type><br>
> <activationId>Repeating as signature [15, 14]</activationId><br>
> <rule>Repeating as signature</rule><br>
> <declarations>$others=MessageAsEvent:[888] uuid=mesC:7 serial=serial123<br>
> count=0(15); $m=MessageAsEvent:[254] uuid=mesC:7 serial=serial123<br>
> count=7(14)</declarations><br>
> <ruleFlowGroup>Signature</ruleFlowGroup><br>
> </org.drools.audit.event.ActivationLogEvent><br>
> <org.drools.audit.event.ActivationLogEvent><br>
> <type>4</type><br>
> <activationId>Repeating as signature [16, 14]</activationId><br>
> <rule>Repeating as signature</rule><br>
> <declarations>$others=MessageAsEvent:[889] uuid=mesC:7 serial=serial123<br>
> count=0(16); $m=MessageAsEvent:[254] uuid=mesC:7 serial=serial123<br>
> count=7(14)</declarations><br>
> <ruleFlowGroup>Signature</ruleFlowGroup><br>
> </org.drools.audit.event.ActivationLogEvent><br>
><br>
> Console:-<br>
> ++++++++++++Gathering in signatures m=MessageAsEvent:[254] uuid=mesC:7<br>
> serial=serial123 count=7 data=null<br>
> ++++++++++++Gathering in signatures m=MessageAsEvent:[254] uuid=mesC:7<br>
> serial=serial123 count=7 data=null<br>
><br>
> with data=null being shown<br>
><br>
><br>
><br>
> Edson Tirelli-4 wrote:<br>
>><br>
>> You must be having a problem with the hibernate query then. Just as a<br>
>> test, try replacing the query call with an arbitrary method call that<br>
>> returns a couple objects.<br>
>><br>
>> Edson<br>
>><br>
>><br>
>><br>
>> 2009/10/29 richarda <<a href="mailto:richard.ambridge@gmail.com">richard.ambridge@gmail.com</a>><br>
>><br>
>>><br>
>>> Using Drools 5.0.1<br>
>>><br>
>>> I get the same results with the below rule.<br>
>>> I leave the System.out.println in, and the rule executes the number of<br>
>>> times for the number of items that should be loaded from the hibernate,<br>
>>> but each time the $o is still null.<br>
>>><br>
>>> the insert seems to be ignored, audit shows no record of it, but I<br>
>>> assume<br>
>>> insert(null) is ignored by drools<br>
>>><br>
>>><br>
>>> Edson Tirelli-4 wrote:<br>
>>> ><br>
>>> > Did you tried this?<br>
>>> ><br>
>>> > when<br>
>>> > $m : MessageAsEvent(uuid=="mesC:7")<br>
>>> > $o : MessageAsEvent(uuid=="mesC:7", id!=$<a href="http://m.id" target="_blank">m.id</a>) from<br>
>>> > hibernateSession.createQuery("from MessageAsEvent where<br>
>>> > serial=?").setParameter(0,$m.serial).list()<br>
>>> > then<br>
>>> > insert($o)<br>
>>> > end<br>
>>> ><br>
>>> > In any case, collect should work too. Which version of drools are<br>
>>> you<br>
>>> > using?<br>
>>> ><br>
>>> > []s<br>
>>> > Edson<br>
>>> ><br>
>>> > 2009/10/29 richarda <<a href="mailto:richard.ambridge@gmail.com">richard.ambridge@gmail.com</a>><br>
>>> ><br>
>>> >><br>
>>> >> Hi again,<br>
>>> >><br>
>>> >> I wish to have a rule that when an Event has a certain uuid then load<br>
>>> >> into<br>
>>> >> working memory all other events that have been received for this<br>
>>> unit...<br>
>>> >><br>
>>> >> So I write the rule:<br>
>>> >><br>
>>> >> rule "Repeating"<br>
>>> >><br>
>>> >> when<br>
>>> >> $m : MessageAsEvent(uuid=="mesC:7")<br>
>>> >> $others : LinkedList() from collect (<br>
>>> >> MessageAsEvent(uuid=="mesC:7", id!=$<a href="http://m.id" target="_blank">m.id</a>)<br>
>>> >> from hibernateSession.createQuery("from<br>
>>> >> MessageAsEvent where<br>
>>> >> serial=?").setParameter(0,$m.serial).list()<br>
>>> >> )<br>
>>> >> then<br>
>>> >> System.out.println("Gathering m="+$m+"<br>
>>> data="+$others);<br>
>>> >> end<br>
>>> >><br>
>>> >><br>
>>> >> Audit log shows: (wish cut and paste would work from Eclipse audit<br>
>>> view)<br>
>>> >><br>
>>> >> <activationId>Repeating [131, 14]</activationId><br>
>>> >> <rule>Repeating FAN</rule><br>
>>> >> <declarations>$others=[MessageAsEvent:[124] uuid=mesC:7<br>
>>> serial=serial123<br>
>>> >> count=7, MessageAsEvent:[94] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[64] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[118] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[112] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[106] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[100] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[88] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[82] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[76] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[70] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[58] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[52] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[46] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[40] uuid=mesC:7 serial=serial123 count=7,<br>
>>> >> MessageAsEvent:[34] uuid=mesC:7 serial=serial123 count=7](131);<br>
>>> >> $m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123<br>
>>> >> count=7(14)</declarations><br>
>>> >> <ruleFlowGroup>Gathering</ruleFlowGroup><br>
>>> >><br>
>>> >><br>
>>> >><br>
>>> >> So, you can see that the rule fired with $others having all the data,<br>
>>> >> and<br>
>>> >> $m being the main uuid<br>
>>> >><br>
>>> >><br>
>>> >> but the output of the rule is:<br>
>>> >> Gathering m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123 count=7<br>
>>> >> data=null<br>
>>> >><br>
>>> >> so, the $others has been translated to a null.<br>
>>> >><br>
>>> >> I'm trying to copy the Expert example:<br>
>>> >><br>
>>> >> import java.util.LinkedList;<br>
>>> >><br>
>>> >> rule "Send a message to all mothers"<br>
>>> >> when<br>
>>> >> $town : Town( name == 'Paris' )<br>
>>> >> $mothers : LinkedList()<br>
>>> >> from collect( Person( gender == 'F', children > 0 )<br>
>>> >> from $town.getPeople()<br>
>>> >> )<br>
>>> >> then<br>
>>> >> # send a message to all mothers<br>
>>> >> end<br>
>>> >><br>
>>> >> which indicates that $mothers will be available in the RHS<br>
>>> >><br>
>>> >> for reference, the audit log shows when the rule fires:<br>
>>> >><br>
>>> >><br>
>>> >> <org.drools.audit.event.ActivationLogEvent><br>
>>> >> <type>6</type><br>
>>> >> <activationId>Repeating [-1, 14]</activationId><br>
>>> >> <rule>Repeating FAN</rule><br>
>>> >> <declarations>$m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123<br>
>>> >> count=7(14)</declarations><br>
>>> >> <ruleFlowGroup>Gathering</ruleFlowGroup><br>
>>> >><br>
>>> >><br>
>>> >> What am I doing wrong?<br>
>>> >> I basically want all the MessageAsEvent added to working memory, so<br>
>>> later<br>
>>> >> other rules will do work on all the events.<br>
>>> >><br>
>>> >> Cheers<br>
>>> >> Ric<br>
>>> >><br>
>>> >> --<br>
>>> >> View this message in context:<br>
>>> >> <a href="http://www.nabble.com/Collect-and-hibernate-tp26112042p26112042.html" target="_blank">http://www.nabble.com/Collect-and-hibernate-tp26112042p26112042.html</a><br>
>>> >> Sent from the drools - user mailing list archive at Nabble.com.<br>
>>> >><br>
>>> >> _______________________________________________<br>
>>> >> rules-users mailing list<br>
>>> >> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>>> >> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>>> >><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > --<br>
>>> > Edson Tirelli<br>
>>> > JBoss Drools Core Development<br>
>>> > JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > rules-users mailing list<br>
>>> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>>> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>>> ><br>
>>> ><br>
>>><br>
>>> --<br>
>>> View this message in context:<br>
>>> <a href="http://www.nabble.com/Collect-and-hibernate-tp26112042p26113182.html" target="_blank">http://www.nabble.com/Collect-and-hibernate-tp26112042p26113182.html</a><br>
>>> Sent from the drools - user mailing list archive at Nabble.com.<br>
>>><br>
>>> _______________________________________________<br>
>>> rules-users mailing list<br>
>>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Edson Tirelli<br>
>> JBoss Drools Core Development<br>
>> JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><br>
><br>
><br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/Collect-and-hibernate-tp26112042p26115484.html" target="_blank">http://www.nabble.com/Collect-and-hibernate-tp26112042p26115484.html</a><br>
<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>