cancel
Showing results for 
Search instead for 
Did you mean: 

Create a generic fail event manager

sazzadul
Champ in-the-making
Champ in-the-making
Hi,

I am trying to create a generic fail event manager by using boundary event but can't get it to work.
What I would like to do is whenever my delegate class adds an execution variable say createActivityFailed then I would like
the boundary event to catch this error and create a user task say FEM.

I have wrapped up all the delegate classes inside a subprocess to acheive a generic way of cathing error.

Currerently our company runs on Webspere process engine server and considering migrating to Activity thus we need to implement this fail event mechanism which the other product have before we can go on migrating all the processes. We have many processes to migrate and we have lots of flows in each process thus we must implement a kind of fail event manager.

I am attaching my demo eclipse project.

Any help or suggestion will highly be appreciated.

Thans in advance.
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
One option is to put all the steps in an embedded subprocess with an error catch event, and fire this event from your Java classes.

sazzadul
Champ in-the-making
Champ in-the-making
Thanks for your input and I am doing just the way you described, but the problem is whenever a servicetask(say the second one) fails I create a usertask so that I can re run the service task again and for that there has to be a sequence flow to all the service tasks which makes the diagram a bit messig and I would love to avoid that if possible because we can potetially have a lot more service tasks(20 to 30).

Do you know of a better solution to this ?

public class OrchestrateDelegate implements ActivityBehavior {
private static Map<String, String> transitions = new HashMap<String, String>();

static {
  transitions.put("Klargjor-og-kjor-opphor", "flow10");
  transitions.put("Sende-brev", "flow22");
  transitions.put("Sende-regnskap", "flow23");
}

@Override
public void execute(ActivityExecution execution) throws Exception {
  String wpsTaskId = (String)execution.getVariable("wpsTaskId");
 
  PvmTransition transition = execution.getActivity().findOutgoingTransition(transitions.get(wpsTaskId));
  execution.take(transition);
}
}

jbarrez
Star Contributor
Star Contributor
mmm, i see indeed the problem. Not very pretty, indeed.

Well, you *could* do it without having the sequence flow, but it requires some serious low level (implementation level) code to get it going.
Best is to check what happens when calling the take() method (but it will be very low-level….)

Another 'hack' which you might do, is to have a pre-processing of your process xml file, and enhance the process with all the sequence flow … but obvious that's not the pretiest of solutions.

sazzadul
Champ in-the-making
Champ in-the-making
I would rather not prefer to do low level so my question is since this problem scenario is very authentic and other activiti users might very well run into same problem,
will you consider make a fix for it in activiti so that we will be able to jump to a specefic service task without defining a flow ?