[rules-users] Help with StatefulSession and Stream Mode

richarda richard.ambridge at gmail.com
Fri Nov 13 06:57:43 EST 2009


I may have solved this, but still not sure I am doing this 'correctly'

I have changed this to use one call to fireUntilHalt()
and then from the insert code it now inserts the fact and runs:
		ksession.startProcess("rulesflow");
(and no fireAllRules)

which seems to bring the engine to life again..

Is this correct?


richarda wrote:
> 
> 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-tp26335206p26335542.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list