How to tell what type of end event an EndEventImpl is?



I am writing an execution listener which gets triggered at every activity. When the class name is “EndEventImpl” I would like to do some housekeeping depending on which type of end event it is, such as ErrorEndEvent, CompensationEndEvent, etc.

If I have an EndEventImpl object, how do I determine this?



Hi @ztaylor,

You can call getEventDefinitions() on the EndEventImpl object (assuming: the object called eeo)

  • In the case of None end event type, eeo.getEventDefinitions().isEmpty() will be true

  • In the case of other end event types, there will be an embedded event definition and you can check its type as follow
    if(eeo.getEventDefinitions().iterator().next() instanceof ErrorEventDefinitionImpl)
    Example of “other end event types”:
    <endEvent id=“EndEvent_2” name=“Tweet rejected”> <terminateEventDefinition id=“TerminateEventDefinition_1”/> <endEvent>