2 Replies Latest reply on Aug 4, 2011 3:14 AM by Ayusman Dikshit

    event handler method not getting invoked in jbpm

    Ayusman Dikshit Newbie

      Hi,

      I have a spring 3 and jbpm 4.4 integration environment.

      However in one of my tasks I have provided a event as per jpdl specs.

       

      My jpdl snippet with the task element looks like this:

       

          <task  name="TK1" 
                assignee="test" 
                    description="A task that gets assigned to somebody with user name test" 
                    g="117,90,48,52">
                  <on event="start">
                              <event-handler expr="#{myEventHandler}"/>
                  </on>
                  <on event="end">
                        <event-handler expr="#{myEventHandler}"/>
                  </on>
            <transition name="END"  to="END" g="-31,2"/>
          </task>
      

       

      and the myEventHandler bean is created in spring as below:

       

          <bean id="myEventHandler" class="com.test.MyEventHandler">
              <!-- myBO bean is created in the spring application context file itself which contains code to insert/update data to DB-->
              <property name="myBO" ref="myBO"/>
          </bean>
      

      and my Event handler class looks like this:

       

          import org.jbpm.api.listener.EventListener;
          import org.jbpm.api.listener.EventListenerExecution;
          
          public class MyEventHandler implements EventListener {
          
              private MyBO myBO;
          
              @Override
              public void notify(EventListenerExecution eventExecution) throws Exception
              {
                  //Do some logical operation based on incoming process variable...
          
                  //Use the myBO bean to do DB operation...
                  myBO.insert(...);
                  myBO.update(...);
              }
          
          }
      

       

      The problem is:

      after trying several options, the notify method NEVER gets executed. I see the tasks getting created in JBPM4_TASK table, but strangely I can not get  the notify() invoked. And there is no form of error or warning to be seen.

       

      Has anybody faced similar problems?

      Is there a way to resolve this?

       

      Any help is appreciated.