开发者

event handler method not getting invoked in jbpm

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.ins开发者_开发技巧ert(...);
        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.


For those who might benefit from this:

The correct tag is:

<event-listener expr="#{myEventHandler}"/>

and not

<event-handler expr="#{myEventHandler}"/>

This was a simple confusion which caused me a lot of trouble.

Moral of the story...

jbpm4 binding and descriptors do not complain about the unknown tags that you might provide...

so be careful. Because there is no xsd validation for optional tags any way.

HTH, Ayusman

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜