cancel
Showing results for 
Search instead for 
Did you mean: 

How to interrupt and end processinstance?

rusty
Champ in-the-making
Champ in-the-making
Hi,

i'm new to Activiti and Bpmn.

Is it possible to model the possibility to interrupt and end a processinstance at any time of the process? I know how to end it with Java but I want it to be modeled.

Maybe I found a way with Bpmn2.0 but Activiti doesn't support the needed events.
So I tried to model a receiveTask in parallel way to the whole process but this doesn't work either.

Does anyone have an idea?


Thanks,
Rusty
15 REPLIES 15

mhw
Champ in-the-making
Champ in-the-making
I am new to BPMN, too Smiley Happy I think the needed cancel event would look like this:

</subProcess>
<boundaryEvent id="_4" name="CancelEvent" attachedToRef="_2">
  <outgoing>_6</outgoing>
  <cancelEventDefinition/>
</boundaryEvent>
<sequenceFlow id="_6" name="Sequence Flow" sourceRef="_4" targetRef="_5"/>
<scriptTask id="_5" name="Goodbye">
  <incoming>_6</incoming>
  <outgoing>_7</outgoing>
  <script>System.out.println(&quot;Cancel of subprocess handled&quotSmiley Wink;</script>
</scriptTask>

[attachment=0]cancelevent.jpg[/attachment]
Is this right? Should I implement behavior like this?

regards,
Michael

rusty
Champ in-the-making
Champ in-the-making
Hi Micheal,

I also thought of this solution but my tutor (i'm a Student, doing an internship) means I shouldn't implement the whole process as a subprocess. I also think there should be another way. For Example to prevent subprocesses in a subprocess.

Regards,
Rusty

mhw
Champ in-the-making
Champ in-the-making
Hi Rusty,

that is an interesting point. But as I understand according to BPMN 2.0 specification:
The catch Cancel Intermediate Event MUST only be attached to the boundary of a Transaction Sub-
Process and, thus, MAY NOT be used in normal flow.
With BPMN we only seem to have the ability to attach the cancel event to a sub process boundary. Perhaps there are other possibilities which I oversee…
With current version of activiti we cannot use the cancel event. So I will try it with a solution similar to your post and will post my results here.

If I should implement the cancel event in activiti, I would need a xml example how it should be.

Regards,
Michael

rusty
Champ in-the-making
Champ in-the-making
After reflecting my examples again, I guess they will not work.
I think if I end one branch of the parallel gateway, the other will continue anyway.

I'm going to test this issue the next days.

albertorugnone1
Champ in-the-making
Champ in-the-making
I am sorry if I am here with a silly question. In my understanding from this discussion to interrupt a process you have to model it by BPMN with a process that seems very complex for newbe like me.
Why is not provided an interrupt function in activiti engine. It seems to me quite natural. Maybe I misunderstood the objective of activiti itself, but really I am a little bit confused.

Kind regards  :ugeek: and Thank you very much for your patience

jbarrez
Star Contributor
Star Contributor
@albertorugnone:  

/** Delete an existing runtime process instance.
   * @param processInstanceId id of process instance to delete, cannot be null.
   * @param deleteReason reason for deleting, can be null.
   * @throws ActivitiException when no process instance is found with the given id.
   */
  void deleteProcessInstance(String processInstanceId, String deleteReason);