[rules-users] stream mode

Khalil Hafsi hafsi at fzi.de
Sun Jan 10 15:29:53 EST 2010


Hi Guys,

I am using DROOLS FUSION last version
It is very important for me that events arrive in the order i fire them
, this is a part of the code used for stream mode :
>             KnowledgeBuilder kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>            
> kbuilder.add(ResourceFactory.newClassPathResource("pol.drl"),
> ResourceType.DRL);
>             if ( kbuilder.hasErrors() ) {
>                 System.err.println( kbuilder.getErrors().toString() );
>             }
>             KnowledgeBaseConfiguration config =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>             config.setOption(EventProcessingOption.STREAM);
>             KnowledgeBase kbase =
> KnowledgeBaseFactory.newKnowledgeBase(config);
>             kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
>            
>             StatefulKnowledgeSession ksession =
> kbase.newStatefulKnowledgeSession();

after this part I just start inserting Events into the ksession , i.e
ksession.insert(new Event(a)) ...

does this suffice to make the the engine in stream mode and hence ordered ?
In the example app , Events were fired as they arrive , but a timestamp
was given , and also agenda and jobs were used.
Is that necessary for the engine to work in stream mode ?
I have a piece of code that gives me different results every time I run
it ?! it is in stream mode , but for some reason the rule either do not
fire , or do not print the output. is there a way to debug into this ?

thank you .
k-




More information about the rules-users mailing list