The usecase is i want to modify the processDefinitionKey during process deployment and want the new key to be persisted. I was just thinking if i can add a BpmnparseListener and set the new key in the processDefinition. How do we configure custom BpmnParserListener or is there some other better way to change the key?
You can indeed use a BPMNParseListener for this, and alter the process-definition ID. When the deployment is parsed and the definition is added to the cache, the listener will be called. Beware, the KEY_ column in the ACT_RE_PROCDEF is determined not the FIRST deployment, so make sure the parse-listener has run when it was deployed, otherwise you can get into trouble…