When I set a process variable through org.camunda.bpm.engine.cdi.BusinessProcess.setVariable() it seems the value is not automatically flushed.
Is there a way to flush the variables without completing the current user task? I thought BusinessProcess.signalExecution() would be the solution but it seems to complete the current task just as BusinessProcess.completeTask() does.
What exactly is the difference between signalExecution and completeTask?
Variables are cached in the Request or Conversation until the unit of work is ended, for example by calling
completeTask(). There is currently no out-of-the-box solution for manually flushing the cached variables. You could work around this by writing a Cdi Bean which injects the ContextAssociationManager and performs the flush:The difference between
signalExecutionandcompleteTaskis as follows:completeTask: will complete the currently associated task using the TaskServicesignalExecution: is more abstract: it sends a signal to the currently associated execution to continue execution. In this case the effect is the same: the task is completed and execution continue. ButsignalExecutionwill also work in situations where there is no Human Task involved (ie. a ReceiveTask).