JBPM 6.0 ksession clustering

My application is based on jBPM 5, and due to some cluster issues, I am testing jBPM 6 to replace the old version. I used an example: https://github.com/jsvitak/jbpm-6-examples/tree/master/rewards-basic

Unfortunately, as far as I tested it, it still has problems with the same KSession with multiple nodes.

RuntimeManager has been configured to use a singleton strategy.

  RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get()
            .newDefaultBuilder()
            .entityManagerFactory(emf)
            .addAsset(ResourceFactory.newClassPathResource("rewards-basic.bpmn"), ResourceType.BPMN2)
            .get();

        environment.getEnvironment().set(EnvironmentName.USE_PESSIMISTIC_LOCKING, true);
    singletonManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
    RuntimeEngine runtime = singletonManager.getRuntimeEngine(new Context() {
        @Override
        public Object getContextId() {
            return singletonManager.getIdentifier();
        }
    });

 KieSession ksession = runtime.getKieSession();

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("recipient", recipient);
        ProcessInstance processInstance = ksession.startProcess(
                "com.sample.rewards-basic", params);

The test is simple:

  • Create the first process on node 1
  • Create a second process on node 2

And after the second step, I always encounter the same Hibernate exception as for jBPM 5:

Called: org.hibernate.StaleObjectStateException: the row was updated or deleted by another transaction (or incorrect matching of unsaved values): [org.drools.persistence.info.SessionInfo # 1]

jBPM 5 KSession , .

, , . , (, ). .

, :

  • KSession ?
  • , jBPM 6 ?
  • , ?
+4

Source: https://habr.com/ru/post/1533156/


All Articles