Global Execution listener not called?

I am having problems using the Global Execution Listener.

We are using Spring boot and have a Spring managed ProcessApplication (annotated with @Component) that extends from SpringBootProcessApplication.
The afterPropertiesSet() method is called correctly, but the getExecutionListener() is never called.

I tracked it down till the point that in the class ProcessApplicationEventListenerDelegate it is unable to find the Target Process Application, it’s because ProcessApplicationManager.registrationsByDeploymentId is empty.

How should the ProcessApplication be registered? (doesn’t that occur automatically in the above Spring config?)
I registered the ProcessApplication in our ProcessApplication.afterPropertiesSet() like this:
processEngine.getManagementService().registerProcessApplication("1", getReference());

In the above call I hardcoded the deploymentId (1), as I noticed it was used to find the the Target Process Application that comes from the DeploymentId.
In this way, the global Execution Listener is fired, but I am confused what the correct way is to use it? And how to correctly register the Process Application such that the listener is used?
Where can I find some example of using it?

I noticed that the deploy() method in the ProcessApplication was never called (compared it with Camunda source examples). So I did that, but then noticed that a ProcessApplication isn’t suitable for us in a multi tenant environment with multiple ProcessEngines as it will try to retrieve a process engine from the processes.xml or, if not found, will try to retrieve the default processEngine, and both will fail.

How can I add a ExecutionListener to a ProcessEngine through code? (I noticed it’s possible through xml, but how can I do it in code?)

See if this helps.