Search code examples
drools

Drools 7: use entry point from consequence (RHS)


How do I insert into an entry point on RHS?

From Mastering JBoss Drools 6 book

rule "Routing.."
when
...
then entryPoints["Stream Y"].insert(t)
end

I'm trying to make this work using Drools 7 but I get an error Unable to build KieBaseModel.

EDIT: Full message:

Unable to Analyse Expression drools.entryPoints["Stream Y"].insert(t);:
[Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.entryPoints()]
[Near : {... drools.entryPoints["Stream Y"].insert ....}]

Note: I've not defined any global called entrypoints.


Solution

  • Apparently, the entryPoints automagic variable is not there anymore in Drools 7. You can try something like this though:

    rule "Routing.."
    when
        ...
    then 
        drools.getEntryPoint("Stream Y").insert(t)
    end
    

    Hope it helps,