cancel
Showing results for 
Search instead for 
Did you mean: 

Skip a call activity

himanshu_mps
Champ in-the-making
Champ in-the-making
Hi,

I have a workflow in which I have multiple subprocesses (using call activity). When a particular subprocess (call activity) is executing, the user should be able to cancel/skip that call activity and should be able to execute the next subprocess in order. Is there any way this can be acheived ?

Thanks,
Himanshu
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Add a catching boundary-event to the call-activity/subprocess, a message-boundary event for example - with cancelActivity="false". Make the outgoing flow go to the next call-activity… Make your UI send a message to the execution to "cancel" the execution of the ongoing call-activity. That should work Smiley Wink

Hi,

I am able to attach the message boundary event. But I don't see any method in the runtime service to actually send a cancel message to the particular process. Could you please provide a code snippet so that it is clear ?

Also, shouldn't be cancelActivity set to "true" in this case ?

frederikherema1
Star Contributor
Star Contributor
Yes, it should indeed be set to "true", the value of the cancelActivity attribute.

Messaging an executions can be done using the runtimeService:


/**
   * Notifies the process engine that a message event with name 'messageName'
   * has been received and has been correlated to an execution with id
   * 'executionId'.
   *
   * The waiting execution is notified synchronously.
   *
   * @param messageName
   *          the name of the message event
   * @param executionId
   *          the id of the execution to deliver the message to
   * @throws ActivitiObjectNotFoundException
   *           if no such execution exists.
   * @throws ActivitiException
   *           if the execution has not subscribed to the signal
   */
  void messageEventReceived(String messageName, String executionId);

The right execution to message can be found using an ExecutionQuery, filtering by processInstanceId and message-event subscription.