camundabusiness-process-management

Difference between PostBPMNParseListeners and PreBPMNParseListeners


While reading about BPMNParseListeners, I noticed 2 different implementations using PostBPMNParseListeners and PreBPMNParseListeners, what is the difference between these two ?

Does this just indicate the sequence of execution of the listeners ? like triggering the listener before or after parsing the BPMN based on which ParseListener has been used.

Please advise.

Thanks


Solution

  • That is correct. The parse listeners are a very flexible tool, which could be used for various, possibly unforeseen things. Having the option to execute code before the engine is parsing the BPMN (PreBPMNParseListeners) and after it does so (PostBPMNParseListeners) opens the door for various engine plugins.

    There is also the AbstractBpmnParseListener.

    Some examples here: https://github.com/camunda-consulting/camunda-7-code-examples/blob/master/snippets/bpmn-parse-listener-on-call-activity/src/main/java/org/camunda/bpm/example/parselistener/CallActivityBusinessKeyParseListener.java

    https://github.com/camunda-consulting/camunda-7-code-examples/tree/master/snippets/email-incident-handler-plugin