protected void invokeVariableListeners(boolean includeCustomerListeners) {
Queue<VariableEvent> variableEventsQueue = getVariableEventQueue();
while (!variableEventsQueue.isEmpty()) {
// do not remove the event yet, as otherwise new events will immediately be dispatched
VariableEvent nextEvent = variableEventsQueue.peek();
CmmnExecution sourceExecution = (CmmnExecution) nextEvent.getSourceScope();
DelegateCaseVariableInstanceImpl delegateVariable =
DelegateCaseVariableInstanceImpl.fromVariableInstance(nextEvent.getVariableInstance());
delegateVariable.setEventName(nextEvent.getEventName());
delegateVariable.setSourceExecution(sourceExecution);
Map<String, List<VariableListener<?>>> listenersByActivity =
sourceExecution.getActivity().getVariableListeners(delegateVariable.getEventName(), includeCustomerListeners);