[jboss-jira] [JBoss JIRA] (DROOLS-2383) Heartbeat example seems broken

Mario Fusco (JIRA) issues at jboss.org
Tue Mar 13 11:22:00 EDT 2018


     [ https://issues.jboss.org/browse/DROOLS-2383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario Fusco resolved DROOLS-2383.
---------------------------------
    Resolution: Rejected


You're creating a KieBaseConfiguration enabling the stream mode, but never using it. You should use the method

{code}
kieContainer.newKieBase(String kBaseName, KieBaseConfiguration conf)
{code}

> Heartbeat example seems broken
> ------------------------------
>
>                 Key: DROOLS-2383
>                 URL: https://issues.jboss.org/browse/DROOLS-2383
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 7.6.0.Final
>            Reporter: Jens Reimann
>            Assignee: Mario Fusco
>
> To me it looks as if the common heartbeat example is broken:
> {code}
> import foo.bar.Heartbeat
> rule "Sound the alarm"
> when
>     $h: Heartbeat( ) from entry-point "MonitoringStream"
>     not( Heartbeat( this != $h, this after[0s,10s] $h ) from entry-point "MonitoringStream" )
> then
>    System.out.println("Sound the alarm");
> end
> {code}
> When running the rule set with:
> {code:java}
> public class Application {
>     public static void main(final String[] args) {
>         final KieServices ks = KieServices.Factory.get();
>         final KieBaseConfiguration config = ks.newKieBaseConfiguration();
>         config.setOption(EventProcessingOption.STREAM);
>         final KieContainer kContainer = ks.getKieClasspathContainer();
>         final KieBase kBase = kContainer.getKieBase("rules");
>         final KieSession kSession = kBase.newKieSession();
>         kSession.getEntryPoint("MonitoringStream").insert(new Heartbeat());
>         kSession.fireUntilHalt();
>     }
> }
> {code}
> Results in:
> {code}
> 11:55:55.092 [main] DEBUG org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found and used pom.properties /home/jreimann/Development/iot-kura-develop-oxygen/ws/drools-test-1/target/classes/META-INF/maven/de.dentrassi.test/drools-test-1/pom.properties
> 11:55:55.095 [main] DEBUG org.drools.compiler.kie.builder.impl.ClasspathKieProject - Discovered classpath module de.dentrassi.test:drools-test-1:0.0.1-SNAPSHOT
> 11:55:55.098 [main] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: FileKieModule[releaseId=de.dentrassi.test:drools-test-1:0.0.1-SNAPSHOT,file=/home/jreimann/Development/iot-kura-develop-oxygen/ws/drools-test-1/target/classes]
> 11:55:55.820 [main] DEBUG org.drools.core.common.DefaultAgenda - State was INACTIVE is now FIRING_UNTIL_HALT
> Sound the alarm
> 11:55:55.850 [main] DEBUG org.drools.core.common.DefaultAgenda - State was FIRING_UNTIL_HALT is now INACTIVE_ON_FIRING_UNTIL_HALT
> {code}
> Which looks to me as if the alarm gets activated right away instead of 10 seconds after.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list