Hello all,

 

I’d like to get Drools working in such a way that it is always running and I can just stream new events into the runtime and have it execute rules against them. From what I can tell I need to use stream mode in order to do this. I’ve got everything set up for how I think it should work (based on what I can decipher from the documentation) but what’s happening is that I’m never getting a hit on the rules I write. I can see the event be asserted but nothing happens.

 

Here is my set up…

 

KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();

config.setOption(EventProcessingOption.STREAM);

setKnowledgeBase(KnowledgeBaseFactory.newKnowledgeBase(config));

 

// Create a knowledge agent to pull load the necessary resources

kagent = KnowledgeAgentFactory.newKnowledgeAgent("MyAgenda", getKnowledgeBase());

initResources(kagent);

setKnowledgeBase(kagent.getKnowledgeBase());

 

getSession().addEventListener(new DebugAgendaEventListener());

getSession().addEventListener(new DebugWorkingMemoryEventListener());

 

And here is how I start up Drools…

 

thread = new Thread() {

    @Override

    public void run() {

        getSession().fireUntilHalt();

    }

};

thread.run();

 

I then feed events into the engine like this…

 

WorkingMemoryEntryPoint stream = getSession().getWorkingMemoryEntryPoint(origin);

stream.insert(event);

 

I’m obviously missing something in my setup. Any help on understanding how this is supposed to work is greatly appreciated. Again, the goal here is to get Drools in a state that is always running so I can pipe in events to it and have rules execute against them.

 

Jean-Philippe