JBPM 4.4例外处理

时间:2011-05-31 14:16:17

标签: jbpm

我没有获得有关如何处理JBPM 4.4中的异常的链接或材料  任何机构都有任何指针或链接,请更新我。

由于 拉维

2 个答案:

答案 0 :(得分:1)

您可以像这样处理节点级别的异常

<node name="Update Ops DC Review">
    <action class="com.vis.vt.client.dc.process.handler.OperationsReviewActionHandler" name="discontinuanceActionHandler"></action>
    <exception-handler exception-class="java.lang.Exception">
        <action name="exceptionHandler" class="com.vis.vt.client.dc.node.ExceptionHandler"></action>
    </exception-handler>
    <transition to="Approve Client DC" name="Accept"></transition>
    <transition to="Complete" name="Deny"></transition>
</node>

这里是上面XML中提到的异常处理程序类的代码;

public class ExceptionHandler extends NodeHandler implements ActionHandler {

private static final long serialVersionUID = 1322446214823660013L;

public void execute(ExecutionContext context) throws Exception {

    HelpDeskTaskData helpDeskTaskData = new HelpDeskTaskData();

    ProcessInstance pi = context.getProcessInstance();

    Node node = context.getToken().getNode();

    String errorNodeName = node.getName();

    long processInstanceId = pi.getId();
    Throwable cause = context.getException();

    Date currentDate = new Date();
    String processName = pi.getProcessDefinition().getName();

    helpDeskTaskData.setErrorNodeName(errorNodeName);
    helpDeskTaskData.setProcessInstanceId(processInstanceId);
    helpDeskTaskData.setCause(cause);
    helpDeskTaskData.setCurrentDate(currentDate);
    helpDeskTaskData.setSourceProcessName(processName);

    ITaskData taskData = (ITaskData) context.getVariable("taskData");
    helpDeskTaskData.setComposedTaskData(taskData);

    pi.suspend();

    ProcessEngine processEngine = ProcessEngine.getInstance();
    processEngine.publish(helpDeskTaskData);

}

}

答案 1 :(得分:0)

与JBPM版本(7.x)相关,您可以检出official JBPM User documentation。 但是可以找到here的更详尽的总结。