Eventname of EventSubscription is always null


#1

I’ve asked this question also on StackOverflow, but maybe this forum is a better place to get some help…
(since I can’t post images here, a full description of the question can be found here: https://stackoverflow.com/questions/51292606/why-is-eventname-of-intermediatethrowevent-always-null)

In short: I’m having a sequential process:

  1. a usertask (userTask A)
  2. an intermediateCatchEvent with a condition (It just waits until a certain processVariable becomes != null)
  3. a usertask.(userTask B)

Everything works perfectly: Completing userTask A makes the intermediateEvent ‘active’, filling in the processvariable makes userTask B ‘active’, completing userTask B ends the process.
All fine.

My question is about the moment the contitional intermedateCatchEvent is ‘active’. At that moment I want tho query the ‘name’ of that event.
Querying the Eventsubscription works: I can query the subscription by using an EventSubscriptionQuery, but the returned EventSubscrption contains no name; it’s null

Opening the bpmn defenition in the modeler show a name (see the picture on stackoverflow), but the EventSubscription in java is always null;

Also, checking the databasetable act_ru_event_subscr also shows an empty column event_name_

What am I missing?


#2

Hi @Pieter_Degraeuwe,

the event subscription of the conditional event doesn’t have a name. The name is only used for message or signal events.

You can use an execution listener to get the name of the current activity. For example execution.getCurrentActivityName()

Does this help you?

Best regards,
Philipp


#3

Ok, thanks, that explains it.
I was trying to determine all ‘current’ activity names for a certain processInstance after execution.
I’ve solved it now to keep the ‘current’ activities (tasks and eventsubscriptions) in a separate table and sync them when the process evolves.
This way I can now make ‘join’ queries on my domain and workflow.

To find the ‘current’ activities, I first get the ActivityInstance of the Process: getRuntimeService().getActivityInstance(processInstance.getId())
Once I have that, I fetch the childActivityInstances. Those are both eventSubscritpions and Tasks.