Hi Jean Philippe,
I managed to get around using kie-spring with KieScanner integration. if you
use exact configuration as below you will be able to setup persistence,
scanner together with spring 6.1.0.
<bean id="kReleaseId"
class="org.drools.compiler.kproject.ReleaseIdImpl">
<constructor-arg index="0" value="xx.yy.zz" />
<constructor-arg index="1" value="artifiactl" />
<constructor-arg index="2"
value="<b>LATEST*" />
</bean>
<kie:kmodule id="kModule">
<kie:kbase name="<b>defaultKieBase*">
<kie:ksession name="<b>defaultKieSession*">
<kie:configuration>
<kie:jpa-persistence>
<kie:transaction-manager ref="txManager" />
<kie:entity-manager-factory ref="myEmf" />
</kie:jpa-persistence>
</kie:configuration>
</kie:ksession>
</kie:kbase>
</kie:kmodule>
<kie:environment id="env">
<kie:entity-manager-factory ref="myEmf" />
<kie:transaction-manager ref="txManager" />
</kie:environment>
<bean id="kiePostProcessor"
class="org.kie.spring.KModuleBeanFactoryPostProcessor">
<property name="releaseId" ref="kReleaseId" />
</bean>
In a separate bean execute below code to set-up scanner (can use
init-method).
ReleaseId releaseId = (ReleaseId)
applicationContext.getBean("kReleaseId");
KieServices ks = KieServices.Factory.get();
KieContainer kieContainer = ks.newKieContainer(releaseId);
KieScanner kieScanner = ks.newKieScanner(kieContainer);
//kieScanner.start(5000L);
kieScanner.scanNow();
Note highlighted text snippets. use them as is. Caveat is , when you set-up
kbase with a release id and kiecontainer, default beans created by spring
would be ignored. instead container would create default kbase and a
ksession(s)(stateful,stateless) for you. those names should be included as
highlighted.
This is totally a workaround I found while debugging and yet to test if
scanner functionality is working properly.
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Persistence-in-Drools-6-tp4...
Sent from the Drools: User forum mailing list archive at
Nabble.com.