[jboss-jira] [JBoss JIRA] (DROOLS-2383) Heartbeat example seems broken
Jens Reimann (JIRA)
issues at jboss.org
Tue Mar 13 07:02:00 EDT 2018
Jens Reimann created DROOLS-2383:
------------------------------------
Summary: Heartbeat example seems broken
Key: DROOLS-2383
URL: https://issues.jboss.org/browse/DROOLS-2383
Project: Drools
Issue Type: Bug
Components: Examples (Workbench)
Affects Versions: 7.6.0.Final
Reporter: Jens Reimann
Assignee: Michael Anstis
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