[jboss-jira] [JBoss JIRA] (DROOLS-422) Timer based rules don't fire and facts can't expire after session restore
Dushman Elvitigala (JIRA)
issues at jboss.org
Mon May 12 07:05:59 EDT 2014
[ https://issues.jboss.org/browse/DROOLS-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12967062#comment-12967062 ]
Dushman Elvitigala commented on DROOLS-422:
-------------------------------------------
Hello Nedo,
I faced the same situation and it throws below stack trace
java.lang.NullPointerException
at org.drools.reteoo.ObjectTypeNode$ExpireJobContextTimerOutputMarshaller.serialize(ObjectTypeNode.java:704)
at org.drools.marshalling.impl.ProtobufOutputMarshaller.writeTimers(ProtobufOutputMarshaller.java:731)
at org.drools.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:186)
at org.drools.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:105)
at org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169)
at org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151)
at org.mayo.ga.ruleengine.handler.ContextClosedHandler.onApplicationEvent(ContextClosedHandler.java:53)
at org.mayo.ga.ruleengine.handler.ContextClosedHandler.onApplicationEvent(ContextClosedHandler.java:25)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)
at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:980)
I have two timer rules in my rule set. Tried out your suggestion by checking out 5.6.0 code base and modifying it. But it did not worked for me. One other thing I noticed is that it gets marshalled for the first time and I can un-marshall it back and create the session. but when I try to marshall it back again it throws above error.
Seems it is a Bug.
Thanks,
Dushman
> Timer based rules don't fire and facts can't expire after session restore
> -------------------------------------------------------------------------
>
> Key: DROOLS-422
> URL: https://issues.jboss.org/browse/DROOLS-422
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.5.0.Final
> Environment: Linux Mint 15
> JBoss AS 5.1
> Reporter: Nedo Nedic
> Assignee: Mark Proctor
> Attachments: drools-mongodb-persistence.zip
>
>
> I have implemented a custom persistence engine for Drools sessions in MongoDB. When session is built for first time, everything works like a charm. I am having some problems when Drools sessions are restored from MongoDB collection. Firstly, interval based rules (for example timer(int: 10s 10s)) don't fire. Some facts that should expire, they just don't expire and remain forever in WM. I attached the source code. When session is built for first time, I use code like this:
> KnowledgeBase kbase = createKBase(getKnowledgeBuilder(rulePackagePath),
> config);
> if (hasKnowledgeAgent) {
>
> createKnowledgeAgent(kbase, correlatorId);
>
> wm = (ReteooStatefulSession) ((KnowledgeBaseImpl) kagent
> .getKnowledgeBase()).ruleBase.newStatefulSession(
> (SessionConfiguration) ksconf, env);
> ksession = new StatefulKnowledgeSessionImpl(wm, kagent
> .getKnowledgeBase());
>
> stateOutputMarshaller = StateMarshallerFactory.newOutputMarshaller(this, ksession, ksconf);
> stateOutputMarshaller.init();
> ((InternalKnowledgeRuntime) ksession).setEndOperationListener(this);
> }
> Then, after every action I update the session in MongoDB collection.
> public void endOperation(InternalKnowledgeRuntime ikr) {
>
> stateOutputMarshaller.marshall();
> }
> For session restoring, after AS restart I use this code:
> KnowledgeBase kbase = createKBase( getKnowledgeBuilder(rulePackagePath), getKBaseConfig() );
> stateInputMarshaller = StateMarshallerFactory.newInputMarshaller( this, kbase, getSessionConf() );
> ksession = stateInputMarshaller.unmarshall(correlatorId);
> stateOutputMarshaller = StateMarshallerFactory.newOutputMarshaller( this, ksession, getSessionConf() );
>
> ((InternalKnowledgeRuntime)ksession).setEndOperationListener(this);
>
> protected static KnowledgeBaseConfiguration getKBaseConfig() {
> KnowledgeBaseConfiguration config = KnowledgeBaseFactory
> .newKnowledgeBaseConfiguration();
> config.setOption(EventProcessingOption.STREAM);
> return config;
> }
> protected static KnowledgeSessionConfiguration getSessionConf() {
> KnowledgeSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> ksconf.setOption(ClockTypeOption.get("realtime"));
> return ksconf;
> }
> Any help is appreciated.
> Thanks
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
More information about the jboss-jira
mailing list