cancel
Showing results for 
Search instead for 
Did you mean: 

Call activity and boundary error event

meditel
Champ in-the-making
Champ in-the-making
Hi, i can't figure out why my process is not working as excepted  Smiley Sad

I have a simple process that calls a call activity catching errors using a boundary event.
[attachment=1]MyProcess.jpg[/attachment]
[attachment=0]ActivityProcess.jpg[/attachment]

The call activity process may throw an error if the msisdn != 0123456789 (PutOrderInDB.java)

public class PutOrderInDB implements JavaDelegate {

   @Override
   public void execute(DelegateExecution execution) throws Exception {
      String msisdn = (String) execution.getVariable("orderMsisdn");
      Long amount = (Long) execution.getVariable("orderAmount");
      String type = (String) execution.getVariable("orderType");
      System.out.println("msisdn from PutOrderInDB class : "+msisdn);
      System.out.println("amount from PutOrderInDB class : "+amount);
      System.out.println("type from PutOrderInDB class : "+type);
      if("0123456789".equalsIgnoreCase(msisdn)) {
         execution.setVariable("isPutInDB", true);
      }
      else {
         execution.setVariable("isPutInDB", false);
      }
   }
}

If i execute the process, i can't see in error in the tomcat logs, but the Activiti explorer remains looping and i can't move forward after that.

I have attached all the project files.
Any hints are welcome.
9 REPLIES 9

meditel
Champ in-the-making
Champ in-the-making
Is that a bug and shall i open a Jira ticket ?

trademak
Star Contributor
Star Contributor
Hi,

I deployed your process, but I can't figure out what your problem is.
If I use an amount of 90 and a msisdn of 0123456789 the process finishes as expected.
If I use an amount of 110 and a msisdn of 0123456789 I get another user task in my list.
All can be explained by the implementation.
So maybe you can explain in more detail what the problem is and how I can reproduce it.

Best regards,

meditel
Champ in-the-making
Champ in-the-making
Hi,
What if you use for example 50 as amount and 055668871 as msisdn. I that working for you ?

With kind regards,
Meditel

trademak
Star Contributor
Star Contributor
Hi,

Then I also get the user task again, just as expected.
So what's the problem?

Best regards,

meditel
Champ in-the-making
Champ in-the-making
Hi,

Very strange!
For your information, i am using Activiti 5.7. I have deployed the same process as you and i used 50 as amount and 055668871 as msisdn and then Activiti explorer2 keeps looping and nothing happened 😕
[attachment=0]loop.jpg[/attachment]

Best regards,
Meditel

trademak
Star Contributor
Star Contributor
Hi,

That's strange indeed. Can you add some additional logging to your process to see what's going on?

Best regards,

meditel
Champ in-the-making
Champ in-the-making
Hi,

I have found what was going wrong.
The called activity must make a reference to the error end event like this :

<error id="[b]myError[/b]" errorCode="error123" />
<process id ….
….
    <endEvent id="endevent2" name="ErrorEnd">
      <errorEventDefinition errorRef="[b]myError[/b]"></errorEventDefinition>
    </endEvent>

And the calling process must add the same error code to the boundary error event :

    <boundaryEvent id="boundaryerror1" name="" attachedToRef="callactivity1">
      <errorEventDefinition errorRef="[b]error123[/b]"></errorEventDefinition>
    </boundaryEvent>

But one more thing to mention here, is that Eclipse activiti plugin does not add automatically "<error id="myError" errorCode="error123" />" to the xxxx.bpmn20.xml generated code.

Best Regards,
Meditel

trademak
Star Contributor
Star Contributor
Hi,

This is not right. It's perfectly fine to have a errorRef="123" in the call activity boundary error event and an errorRef="123" in the error end event.
You don't need the error element to make this work. So the Designer only generates the errorRef="123" alternative.

Best regards,

meditel
Champ in-the-making
Champ in-the-making
I confirm.

Best Regards,
Meditel