[
https://issues.jboss.org/browse/DROOLS-507?page=com.atlassian.jira.plugin...
]
Davide Sottara commented on DROOLS-507:
---------------------------------------
The FireUntilHalt command is marked as unpersistable (for obvious reasons - it is usually
executed in a dedicated thread), which
causes the exception even before the command is attempted.
Could you elaborate more on your use cases? In particular, what would you expect to happen
if a running session was persisted
and then restored?
Cannot issue fireUntilHalt when using persisted session
-------------------------------------------------------
Key: DROOLS-507
URL:
https://issues.jboss.org/browse/DROOLS-507
Project: Drools
Issue Type: Feature Request
Affects Versions: 6.1.0.Beta3
Environment: Mac OSX Maverick, Spring 4.0.1
Reporter: Roger Lefebvre
Assignee: Mark Proctor
Generating the following exception when using runUntilHalt() with persistence.
Exception in thread "SimpleAsyncTaskExecutor-1"
java.lang.UnsupportedOperationException: Command session.fireUntilHalt(); cannot be issued
on a persisted session at
org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:474)
at
org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353)
at
org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.fireUntilHalt(CommandBasedStatefulKnowledgeSession.java:272)
at com.s.c.m.CallHandler$RunEngine.run(CallHandler.java:115) at
java.lang.Thread.run(Thread.java:722)
Persistence and KieSession defined in Spring as follows:
<!-- provides KnowledgeStoreService implementation -->
<kie:kstore id="kstore"/>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"
/>
<property name="url"
value="jdbc:mysql://localhost:3306/ruleEngine" />
<property name="username" value="xxxxxx" /> <property
name="password" value="yyyyyyyy" />
</bean>
<bean id="emf"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName"
value="org.drools.persistence.jpa.local"/>
</bean>
<bean id="txManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="emf"/>
</bean>
<kie:kmodule id="callManagerModule">
<kie:kbase name="commandKBase" packages="rules.command"
eventProcessingMode="stream">
<kie:ksession name="commandEngine"
type="stateful"></kie:ksession>
</kie:kbase>
<kie:kbase name="campaignKBase" packages="rules.campaign.*"
eventProcessingMode="stream" equalsBehavior="equality">
<kie:ksession name="campaignEngine" type="stateful" >
<kie:consoleLogger/>
<kie:configuration>
<kie:jpa-persistence>
<kie:transaction-manager ref="txManager"/>
<kie:entity-manager-factory ref="emf"/>
</kie:jpa-persistence>
</kie:configuration>
</kie:ksession>
</kie:kbase>
</kie:kmodule>
<bean id="taskExecutor"
class="org.springframework.core.task.SimpleAsyncTaskExecutor">
<property name="daemon" value="true"/>
</bean>
<bean id="campaignHandler" class="com.s.c.m.CallHandler"
init-method="init">
<constructor-arg type="org.springframework.core.task.TaskExecutor"
ref="taskExecutor"/>
</bean>
I invoke fireUntilHalt method as follows:
private TaskExecutor taskExecutor;
public CampaignCallHandler(TaskExecutor taskExecutor) {
this.taskExecutor = taskExecutor; }
public void init() { taskExecutor.execute(new RunEngine()); }
class RunEngine implements Runnable {
@Override public void run() { campaignEngine.fireUntilHalt(); } }
NOTE: This occurs on a new system where nothing has been persisted to the database. In
other words, there isn't a session available to be loaded. I have yet to have success
reloading a session - that is a separate issue that I believe DROOLS-422 partially
identifies.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)