FlowableEventListener for EventSubscriptions


I have a FlowableEventListener that gets the events from the flows (PROCESS_STARTED, PROCESS_COMPLETED, TASK_CREATED, ACTIVITY_MESSAGE_WAITING, …).

I want to be able to get the Event Subscriptions as soon as they are created in a flow.

Catching ACTIVITY_MESSAGE_WAITING, this listener notifies me that the process has created new Message Events, but if I query in this moment the runtime service, I’m getting nothing:

List eventSubscriptions = runtimeService
.createEventSubscriptionQuery() .processInstanceId(notificationPidDocument.getPid().getProcedure().getProcessInstanceId())

If I query after from other part of the code, I can retrieve those events without any problem, but no in the FlowableEventListener.

How can I retrieve the Message Event Subscriptions as soon as they are created?