Process Application Event Listeners - Access to process Instance

@SpringBootApplication
@ProcessApplication
public class Application extends SpringBootProcessApplication {

    @Autowired
    private RuntimeService runtimeService;

   ...

   @Override
    public TaskListener getTaskListener() {
        return new TaskListener() {
            public void notify(DelegateTask delegateTask) {
                // handle all Task Events from Invoice Process
                ProcessInstance processInstance = runtimeService
                                                     .createProcessInstanceQuery()
                                                     .processInstanceId(delegateTask.getProcessInstanceId())
                                                     .singleResult();
            }
        };
    }

    ...
}

I can’t understand why the processInstance is null when there’s an event.

Hi @nestolalu,

Is it possible to share an example of your project maybe in github?

Best regards,
Yana