Richard Evans [https://community.jboss.org/people/r3vans] created the discussion

"Using multiple kSessions"

To view the discussion, visit: https://community.jboss.org/message/744551#744551

--------------------------------------------------------------
I have not been able to get multiple sessions working properly:

* I declare multiple sessions in the spring context (see below).
* I start a pool of threads. As each thread is executed I grab session and save 
it in a ThreadLocal.
* I despatch calls to kSession.startProcess in each thread.

Is this a reasonable approach?

I find that this will run OK for a while but ultimately will fail either with 
an NPE in ProcessInstanceImpl getProcess because kruntime is null OR will fail 
to commit a transaction because it has already been committed.

Regards,
Richard





<drools:ksession id="kSession1" type="stateful" kbase="kBase">
    <drools:configuration>
        <drools:work-item-handlers>
            <!-- Process : ServiceNowCMDB CreateCI -->
            <drools:work-item-handler name="ServiceNowCmdbMapperST" 
ref="ServiceNowCmdbMapperHandler"/>
            ...etc

        </drools:work-item-handlers>
        <!-- jBPM Persistence -->
        <drools:jpa-persistence>
            <drools:transaction-manager ref="transactionManager" />
            <drools:entity-manager-factory ref="entityManagerFactory" />   
        </drools:jpa-persistence>
    </drools:configuration>
</drools:ksession>

<drools:ksession id="kSession2" type="stateful" kbase="kBase">
    <drools:configuration>
        <drools:work-item-handlers>
            <!-- Process : ServiceNowCMDB CreateCI -->
            <drools:work-item-handler name="ServiceNowCmdbMapperST" 
ref="ServiceNowCmdbMapperHandler"/>
            ...etc

        </drools:work-item-handlers>
        <!-- jBPM Persistence -->
        <drools:jpa-persistence>
            <drools:transaction-manager ref="transactionManager" />
            <drools:entity-manager-factory ref="entityManagerFactory" />   
        </drools:jpa-persistence>
    </drools:configuration>
</drools:ksession>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/744551#744551]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to