Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-507

Cannot issue fireUntilHalt when using persisted session

    XMLWordPrintable

Details

    • Feature Request
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 6.1.0.Beta3
    • None
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            mproctor@redhat.com Mark Proctor
            rogeral Roger Lefebvre (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: