[rules-users] Help with StatefulSession and Stream Mode

richarda richard.ambridge at gmail.com
Fri Nov 13 06:31:00 EST 2009


Hi all,

 I am stuck trying to understand how to setup my drools system..

 I am using Stream mode, with some negative rules, and a continuous stream
of facts.
Facts are evaluated and will in turn insert events into the memory if
required.

I thought it would be like this:
First, setup,

KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(conf);
kbase.addKnowledgePackages(builder.getKnowledgePackages());
ksession = kbase.newStatefulKnowledgeSession();

Then we have ksession...
The code that handles an incoming message will have a reference to
ksession..
and it will run:

WorkingMemoryEntryPoint eStream =
ksession.getWorkingMemoryEntryPoint("MessageStream");
eStream.insert(msg);
ksession.fireAllRules();

but here is my problem...
as some rules have things like  not(Event(this after [0s,90m] $a))
then the fireAllRules can wait for the 90minutes to pass before completing..

How do I do it so that there is one WorkingMemory, 
and I can pump facts into that memory and the engine just keeps running and
my 'inputter' doesn't hang..?

Thanks
Ric

-- 
View this message in context: http://old.nabble.com/Help-with-StatefulSession-and-Stream-Mode-tp26335206p26335206.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list