Goal : write a JavaDelegate that is available for use in the BPMN model to be executed in the Run Distro.
Back story: I’m developing an engine plug-in with several listeners and have them all in the same package namespace. 2 of them I am parsing and adding to the model programmatically. (Using this for Run Distro plugins.) One is for all tasks and the other is for the Start activity. Those I want to fire all the time. Then I created another Execution Listener class (copied from the one I was using for the Start Activity listener), but did not add it to the BPMN Parse Listener class methods. I figured it would be found and available by the Spring framework so that I could put the class’ qualified name in the model, and I expected that it would not run anywhere other than where it was manually defined in the model.
Unexpected result: Turns out that somehow, the class got picked up and attached to the Start activity all by itself and was run. Doing a little debugging, I can see in the PvmAtomicOperationProcessStart there is a list of listeners. This list contains the two listeners, but the one I want on the Start activity has the class name I gave it, whereas the one that isn’t supposed to be there and was dynamically discovered is an object of type org.camunda.bpm.engine.impl.bpmn.listener.ClassDelegateExecutionListener. I also tried to convert it just to a JavaDelegate instead of ExecutionListener and it still got picked up and attached. I then moved it out of the package/namespace that Spring was configured to load, and then got “class not found”.
Edit : I’ve done a little more testing with my model by adding additional script activities. It seems that the class in question only gets added automatically to the Start activity. The ActivityID is “StartEventProcessStarted”
Questions:
- How exactly is the class getting discovered and attached when I didn’t put it in the BPMN model?(I’m just looking to understand the lifecycle.)
- What’s the ideal way to get a JavaDelegate available to the Run distribution that will be running in a Docker container?
- Can I have one package for all my classes or do I have to break them out somehow?
- Or do I need completely separate jar files compiled? One with plugins that will be parsed and another for delegates that won’t?
Thanks in advance.
-Doug