Use process plugin. Below reference https://github.com/camunda/camunda-bpm-examples/tree/master/process-engine-plugin