Hi Wolfgang,
i think that have to study more in deed some manuals, because there are some aspects not very clear, in particular the threads behavior.
For example, i have a class running in a container (thread A) that launch the session as follow:
......
        ksession = kbase.newStatefulKnowledgeSession();
......
        Thread t = new Thread(new Runnable() { public void run() { ksession.fireUntilHalt();}});
        t.setName("ExpertSystem");
        t.start();

the same thread A insert event into a stream:
.....
        entryPoint = ksession.getWorkingMemoryEntryPoint(entryPointName);
.....
        entryPoint.insert(obs);

i have a rule some rules such as these:

rule "gas1-event"
    salience 10
    no-loop
    when
        $obs    : GasObservation( $obsLocation : location, gasname == "UN 1017", value > 60 ) over window:length(1) from entry-point lowLevelSensorStream
        not GasEvent( gasname == "UN 1017", this meets[50s] $obs, location geoIntersects $obsLocation )
    then
        insert(new GasEvent( $obs, "UN 1017 value > threshold[60]", Event.THREAT_HIGH, $obsLocation, $obs.getSensor()));
end
rule "gas1-event-update"
    salience 5
    no-loop
    when
        $obs    : GasObservation( $obsLocation : location, gasname == "UN 1017", value > 60 ) over window:length(1) from entry-point lowLevelSensorStream
        $event     : GasEvent( gasname == "UN 1017", this meets[50s] $obs, location geoIntersects $obsLocation )
    then
        Event e = Event.clone($event);
        insert( e );
        retract($event);
        retract($obs);
end

i see that there are some other threads that insert new event and some others retract them.
How is the thread model?

Thanks a lot,
Matteo.

2012/3/2 Wolfgang Laun <wolfgang.laun@gmail.com>
What's the declare for the Event type? What does rule gas2-event do?
-W


2012/3/2 Matteo Cusmai <cusmaimatteo@gmail.com>
Hi all,
i have a big problem with drools fusion.

I insert some new event (pojo object) into Working Memory, but another thread retract it after a few ms.

Someone could tell me why?

Thanks a lot,



[java] gas2-event: 1330701201208
     [java] INFO  [2012-03-02 16:13:21,261] [ExpertSystem] (ExpertVS.java:141)     - **** eventRetracted: 1330701201232/30/32/0/100
     [java] INFO  [2012-03-02 16:13:31,224] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.GasObservation@1a30ef85
     [java] INFO  [2012-03-02 16:13:31,225] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.GasObservation@2bd1232
     [java] INFO  [2012-03-02 16:13:31,226] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.GasObservation@4045acb5
     [java] INFO  [2012-03-02 16:13:31,227] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.TemperatureObservation@1e4dc00a
     [java] INFO  [2012-03-02 16:13:31,227] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.HumidityObservation@27ae011
     [java] INFO  [2012-03-02 16:13:31,227] [pool-1-thread-1] (ExpertVS.java:124)     - **** eventInserted: 1330701211226/30/32/0/100
     [java] INFO  [2012-03-02 16:13:31,240] [Thread-19] (ExpertVS.java:135)     - objectInserted org.dfms.model.observation.RadiationObservation@510c7d5c
     [java] INFO  [2012-03-02 16:13:31,251] [pool-1-thread-1] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:105:45945394:45945394:105:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.GasObservation@2bd1232, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:105:45945394:45945394:105:lowLevelSensorStream, leftTuple=1:105:45945394:45945394:105:lowLevelSensorStream
     [java] [fact 0:0:124232201:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0]
     [java] , originOffset=-1, propagationNumber=220, rule=[Rule name=gas2-event, agendaGroup=MAIN, salience=10, no-loop=true], type=1]]
     [java] gas2-event: 1330701211203
     [java] INFO  [2012-03-02 16:13:31,261] [ExpertSystem] (ExpertVS.java:141)     - **** eventRetracted: 1330701211226/30/32/0/100
     [java] INFO  [2012-03-02 16:13:31,262] [ExpertSystem] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:101:1512664237:1512664237:101:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.TemperatureObservation@5a296cad, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:101:1512664237:1512664237:101:lowLevelSensorStream, leftTuple=null, originOffset=-1, propagationNumber=224, rule=null, type=1]]
     [java] INFO  [2012-03-02 16:13:31,262] [ExpertSystem] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:102:1436418073:1436418073:102:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.HumidityObservation@559e0019, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:102:1436418073:1436418073:102:lowLevelSensorStream, leftTuple=null, originOffset=-1, propagationNumber=226, rule=null, type=1]]
     [java] INFO  [2012-03-02 16:13:31,263] [ExpertSystem] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:103:2014876984:2014876984:103:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.RadiationObservation@78189538, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:103:2014876984:2014876984:103:lowLevelSensorStream, leftTuple=null, originOffset=-1, propagationNumber=228, rule=null, type=1]]
     [java] INFO  [2012-03-02 16:13:41,228] [ExpertSystem] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:108:508411914:508411914:108:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.TemperatureObservation@1e4dc00a, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:108:508411914:508411914:108:lowLevelSensorStream, leftTuple=null, originOffset=-1, propagationNumber=230, rule=null, type=1]]
     [java] INFO  [2012-03-02 16:13:41,230] [ExpertSystem] (ExpertVS.java:143)     - objectRetracted ==>[ObjectRetractedEventImpl: getFactHandle()=1:109:41607185:41607185:109:lowLevelSensorStream, getOldObject()=org.dfms.model.observation.HumidityObservation@27ae011, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@7224e11c, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::lowLevelSensorStream, factHandle=1:109:41607185:41607185:109:lowLevelSensorStream, leftTuple=null, originOffset=-1, propagationNumber=232, rule=null, type=1]]


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users