4 Replies Latest reply on Aug 17, 2015 2:24 AM by swiderski.maciej

    How to register a DeploymentEventListener in jBPM 6

    pschaefer

      Hello, how can I register a deploymentEventListener in jBPM 6? I found the method addListener() in DeploymentService, but it does not register my Listener. What is the common approach, doing this? Thank you!

        • 1. Re: How to register a DeploymentEventListener in jBPM 6
          swiderski.maciej

          are we talking about workbench or embedded?

           

          for workbench best is to use CDI that simply define methods with observers so they will be called by cdi container.

          For embedded the manual registration should work as long as the listener is of proper type.

           

          HTH

          • 2. Re: How to register a DeploymentEventListener in jBPM 6
            pschaefer

            I use jBPM as embedded. I developed my own application around jBPM using CDI and the jBPM services. The problem I try to solve is to do certain stuff, after I deployed a new process. I deploy a new DeploymentUnit like this:

             

            String[] gav = deploymentId.split(":");
            KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(gav[0], gav[1], gav[2]);
            
            
            
            deploymentService.deploy(deploymentUnit);
            
            
            
            
            

             

            I discoverd that the super Class of DeploymentService has a map with DeploymentEventListeners and these listeners get informed when the Deployment finished. The DeploymentService has also a Method addListener, but I don't know if this is the correct one to use. I have implemented my own DeploymentEventListener and have done something like this:

             

            ((ListenerSupport)deploymentService).addListener(deploymentEventListener);
            

             

            But my Listener gets never called. What am I doing wrong?

            • 3. Re: How to register a DeploymentEventListener in jBPM 6
              pschaefer

              I found the solution, you can simply do:

               

              public void onDeploy(@Observes @Deploy DeploymentEvent event) { }
              

               

              Then thrrough CDI observer capabilities the method gets called.

              • 4. Re: How to register a DeploymentEventListener in jBPM 6
                swiderski.maciej

                feel free to mark question as answered so others can find it useful