Some code snippets that I've used:
import org.drools.time.SessionPseudoClock;
SessionPseudoClock clock;
void advance( Date eventDate ){
long currentTime = clock.getCurrentTime();
long eventTime = eventDate.getTime();
clock.advanceTime( eventTime - currentTime, TimeUnit.MILLISECONDS );
}
KnowledgeSessionConfiguration kSessionConfig =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
kSessionConfig.setOption( ClockTypeOption.get("pseudo") );
kSession = kBase.newStatefulKnowledgeSession( kSessionConfig, null );
clock = kSession.getSessionClock();
SomeEvent event = ...;
advance( event.getTimestamp() );
eventStream.insert( event );
kSession.fireAllRules();
On 20/01/2012, MartinSimo <simo.fora(a)gmail.com> wrote:
Hi,
unfortunately I haven't found any way to set the pseudo clock according to
timestamp (the "session.insert()") in
org.jboss.soa.esb.actions.BusinessRulesProcessor which I am using to fire
the rules from ESB.
I'll try to write my own class to fire the rules, where I can also use
"session.insert()" to synchronize the clock.
the only thing I do not understand is, why it is possible to set the
<property name="ruleClockType" value="PSEUDO" /> in ESB, but I
have no
property to control the session clock...
Thank you for your help.
r.
--
View this message in context:
http://drools.46999.n3.nabble.com/Fusion-historical-data-analysis-tp36735...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users