Hi Edson ,

Thanks for your much appreciated help,
I have now enabled stream mode and I passed the config to the base as you have stated.

Now I have rerun the tests but I don't get any results .Is there anything that I should add to the event class or maybe the rule file , to make use of time-stamping (I assumed that in stream mode events are automatically timestamped) ?

About the conflict resolution strategies used in DROOLS . Should the user create his own conflict resol. stra. or are they part of Fusion ? If so can you please guide me to the documentation where it is mentioned.

Thank you for your time.
Khalil

Edson Tirelli wrote:

   You are not using the configuration you created... you need to pass it as a parameter to the factory:


            KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
            config.setOption(EventProcessingOption.STREAM);

            KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( config );
            kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());          


   As it is now, your are using CLOUD mode. Since you are not timestamping events, the engine is using the system clock and your application should not rely on the matching order. If you need a specific matching order, you need to use one of the conflict resolution strategies (like salience).

   Edson

2009/12/14 Khalil Hafsi <hafsi@fzi.de>
Hi Edson,

I am running in stream mode , I used this function

config.setOption(EventProcessingOption.STREAM);

to enable it.

About the clock and time stamping I am not using anything special , this is the initiation part of my main :


            KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            kbuilder.add(ResourceFactory.newClassPathResource("pol.drl"), ResourceType.DRL);
            if ( kbuilder.hasErrors() ) {
                System.err.println( kbuilder.getErrors().toString() );
            }
            KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
            kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());          

            KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
            config.setOption(EventProcessingOption.STREAM);
            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
            WorkingMemoryEntryPoint mainS = ksession.getWorkingMemoryEntryPoint( "mainS" );

Thank you,
Khalil Hafsi

Edson Tirelli wrote:

   Are you running in STREAM or CLOUD mode? What clock are you using? Are you timestamping the events or are you using the clock to timestamp them?

   Edson

2009/12/14 Khalil Hafsi <hafsi@fzi.de>
Hi Guys,

I was working lately with drools fusion, we wanted to know what event
consumption policy was implemented.
We made the following simple rule :

rule a

   when
       $c1 : Event(symbol == 1 , $l1 :load) from entry-point "mainS"
        and
       $c2 : Event(this after $c1,symbol == 2,$l2 :load) from
entry-point "mainS"

   then
       System.out.println("event1 "+$l1+" event2 "+$l2);

end

The event class has just symbol : int and load : int , load is used to
differentiate between different events that have the same symbol.

and then we declared the following events into the stream using the
constructor Event(symbol,load): with mainS being a WorkingMemoryEntrypoint

           mainS.insert(new Event(1,10.0));
           mainS.insert((new Event(1,20.0)));
           mainS.insert((new Event(1,30.0)));
           mainS.insert(new Event(2,80.0));
           mainS.insert(new Event(2,90.0));


We have the following output :

         event1 30.0 event2 90.0
         event1 20.0 event2 90.0
         event1 10.0 event2 90.0
         event1 10.0 event2 80.0

So what is exactly the consumption policy used in DROOLS ? It seems that
is unrestricted for event 90.0 and chronological for event 80 .

We have tested different situations and order of events and we always
came to the conclusion that for the first $c2 the policy is
chronological and for all the other $c2's it is unrestricted.

Thank you for you time.
Khalil

_______________________________________________




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com

_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users