Proper way to set or update JBPM6 Process Variables

前端 未结 2 1156
刺人心
刺人心 2021-01-28 00:29

I am trying to set the process variable but getting below error

java.lang.IllegalStateException: Process instance 10[SampleBusinessProcess] is disconnected.
at          


        
2条回答
  •  抹茶落季
    2021-01-28 01:23

    I would recommend to use the jbpm-services for interacting with the engine, this offers an operation to set a variable: https://github.com/kiegroup/jbpm/blob/7.7.0.Final/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/ProcessService.java#L223

    Alternatively, if you make sure that your code is executed in the same transaction (by for example starting and committing the transaction yourself, around the code you currently have), you will be able to set the variable this way, as the process instance will only disconnect as soon as the transaction commits.

提交回复
热议问题