[rules-users] How to configure to reload the drools knowledge session when server(tomcat) restart using Spring

scarlettxu xu_han_zi at 163.com
Mon Mar 3 22:50:53 EST 2014


Hi Expert, I have posted a problem about the drools session persistence in
StackOverflow, but have not got answer for 10 days.
http://stackoverflow.com/questions/21928187/how-to-configure-to-reload-the-drools-knowledge-session-when-servertomcat-rest/22162188#22162188

I would like to re-post the problem here




I am using the drools server 5.5 Final with Spring to configure the
knowledge session to persist to database(mysql) and expect it will reload
the session when server(tomcat) restart. code snippet as below



I can see it will insert the session info to Mysql when Tomcat restart each
time

How to configure to reload the session from Database if the session has been
persisted before?


after several days searching, 

Finally, we happen to see the src code of KnowledgeSessionDefinitionParser
which will parse the spring configuration file
http://grepcode.com/file/repo1.maven.org/maven2/org.drools/drools-spring/5.5.0.Final/org/drools/container/spring/namespace/KnowledgeSessionDefinitionParser.java?av=f

in the code, it will get the value of 'load' attribute and use as the
sessionId to reload. so we tested to add load="sessionId" and it is ok to
reload. but if config the sessionId to a number which does not exist in the
DB, it will throw exception



For a real application, it is impossible to know the sessionId when do the
src configuration, also have not found drools have provided any way for us
to pre-set the sessionId.

so is it the correct solution? Any one have advanced opinion?




--
View this message in context: http://drools.46999.n3.nabble.com/How-to-configure-to-reload-the-drools-knowledge-session-when-server-tomcat-restart-using-Spring-tp4028477.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list