cancel
Showing results for 
Search instead for 
Did you mean: 

Support of error events, how to handle task errors

jan_lisse
Champ in-the-making
Champ in-the-making
Hello,

i'm using the latest Activiti release 5.0rc1. What is the suggested way to handle errors that might occur in an activity/process? I want to have 2 ways of processing in my workflow: one for normal execution and an alternative path in case of an error that might occur in a Java Service Task. BPMN 2.0 defines an Error event node. Is it supported yet or are there plans to support it in the near future?

Best regards + thx for help in advance,
-jan
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
Hi Jan, a catching error event is not yet implemented, so there is not real way currently of handling that exception.
It is on the roadmap for one of the next releases.

jan_lisse
Champ in-the-making
Champ in-the-making
Hi Joram,

thank you very much for clarification!
I'm quite new to the BPM world and my first understanding is that every serious process
requires some kind of error handling (on the implementation level as well as on the process modelling level).
Since Activiti seems to be used in production environments yet, i'm asking myself whether those applications completly avoid error handling in the model or if they have some way to work around the currently missing catching error event.

Best regards,
Jan

jbarrez
Star Contributor
Star Contributor
In Service Tasks, you can always catch exceptions and select the right sequence flow yourself (note; you then need to implement the ActivityBehvior interface).

luisalves00
Champ in-the-making
Champ in-the-making
Hello jbarrez,

about exception handling got a question about ServiceTasks. As I understand they are sync.

So I want to know if these approach for exception handling work:

mock of the workflow

start—ST1—-ST2—-ST3——end
              |                    |
              |—–UT1—–|   <– In case of an exception in this path, I always get back to UT1…right?


       try{
             ….some code…
            ProcessInstance processInstance =      engine.getRuntimeService().startProcessInstanceByKey("myWorklow", variableMap);
            LogAsInfo("Workflow started successfully with: \n"
                    + "ID: " + processInstance.getId() + "\n DefinitionID: " + processInstance.getProcessDefinitionId());
        } catch (Exception e) {
            throw new Exception("Failed to Start Workflow", e);
        }

If an exception happens on ST2 the try catch block will be capable of catching it? then I'll do the proper rollback actions…