1 Reply Latest reply on Jan 16, 2014 11:45 AM by Fer Gia

    Process Event listener : not able to register

    rdeveloper87 Newbie



      I am adding a process event listener to a process as follows:


      public KieSession createKnowledgeSession(

        String processName) {

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

        kbuilder.add(ResourceFactory.newClassPathResource(processName), ResourceType.BPMN2);

        KnowledgeBase kbase = kbuilder.newKnowledgeBase();

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.addEventListener(new SampleProcessEventListener());

        return ksession;



      When i put my flow in debug mode , i do not traverse the afterProcessStarted method.

      Am i missing something while doing this.


        • 1. Re: Process Event listener : not able to register
          Fer Gia Newbie


          You must to create a class that implements EventListenerProducer<ProcessEventListener> and anotate it with @Process like this:


          public class ProcessEventProducer implements EventListenerProducer<ProcessEventListener> {
            private YourProcessEventListener listener;
            public List<ProcessEventListener> getEventListeners(String identifier,  Map<String, Object> params) {
             List<ProcessEventListener> list = new ArrayList<ProcessEventListener>();
             return list;

          And you must to use a InjectableRegisterableItemsFactory in your RuntimeEnvironmentBuilder


          Hope it helps!

          1 of 1 people found this helpful