FlowableEventListener for Process Completion not giving variables

I have configured a FlowableEventListener. The issue I am seeing is that the getProcessVariables always returns 0.

  • I start the process with variables, I can see them in database
  • I complete human task and process ends.
  • My expectations are that the process variables would be avaliabe in following code, but logs show otherwise:
    2019-07-31 12:42:41.696 INFO [gpa-workflow-service,6f6378718b3cb6fc,6f6378718b3cb6fc,false] 20621 — [ XNIO-1 task-4] .m.g.w.e.l.ProcessCompletedEventListener : Process Completed Listener : 0

Listener Stub:

class ProcessCompletedEventListener implements FlowableEventListener {

void onEvent(FlowableEvent event) {
    FlowableEntityEventImpl flowableEntityEvent = (FlowableEntityEventImpl) event
    ProcessInstance processInstance = (ProcessInstance) flowableEntityEvent.entity

    log.info("Process Completed Listener : ${processInstance.getProcessVariables().size()}")


boolean isFailOnException() {
    return false

boolean isFireOnTransactionLifecycleEvent() {
    return false

String getOnTransaction() {
    return null

}indent preformatted text by 4 spaces

Here is my config the binds the listeners:

class FlowableConfigurationConfigurer implements 
EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {

TaskCreatedEventListener taskCreatedEventListener

TaskCompletedEventListener taskCompletedEventListener

ProcessCompletedEventListener processCompletedEventListener

void configure(SpringProcessEngineConfiguration engineConfiguration) {
    //IDM Service
    engineConfiguration.setIdmEngineConfigurator(new CustomIdentityConfigurator())
    //Engine Event Listeners
    engineConfiguration.typedEventListeners = addEngineEventListeners()


private LinkedHashMap<String, List<FlowableEventListener>> addEngineEventListeners() {
    Map<String, List<FlowableEventListener>> typedEventListeners = [:]
    typedEventListeners.put(FlowableEngineEventType.TASK_CREATED.toString(), [taskCreatedEventListener])
    typedEventListeners.put(FlowableEngineEventType.TASK_COMPLETED.toString(), [taskCompletedEventListener])


Also should note that the TASK_COMPLETED listener has the variables.

getProcessVariables() only works when doing a query, see the javadoc on it:

* Returns the process variables if requested in the process instance query

To get the variables you can cast it to a DelegateExecution and do .getVariables()

Cast works.