<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Activiti 5.22: Message-Cancelled Call Activity doesn't fire subprocess PROCESS_CANCELLED in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/activiti-5-22-message-cancelled-call-activity-doesn-t-fire/m-p/40133#M16826</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;(Title originally indicated v5.18, but we are on 5.22).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a process instance ends via an end event a PROCESS_COMPLETE listener event fires.&amp;nbsp; If the process hits a terminate end event PROCESS_CANCELLED fires.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When that subprocess is the result of a Call Activity and the Call Activity receives a boundary message, placed on top of the element in the Eclipse designer, the subprocess does indeed get killed off, but as best I can tell,&amp;nbsp;&lt;EM&gt;the PROCESS_CANCELLED event doesn't fire&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone else run into this?&amp;nbsp; How did you solve it?&amp;nbsp; The problem for my company is that we have to keep our legacy system in sync with the Activiti workflow and orchestration.&amp;nbsp; Certain subprocesses are "orders" and when we instantiate those subprocesses, we have a matching task in our legacy system.&amp;nbsp; That "task" for us isn't a real task, its more of a "task container".&amp;nbsp; When the order process starts, we go to our internal API, create the matching wrapper, get our unique id, then store that ID as a process variable on the order subprocess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever that process ends, we have to tell the API "Hey, we're done.&amp;nbsp; Here's the 'completeTaskEventTrackingId' you gave me earlier...close it."&amp;nbsp; For us, if the process ends gracefully, we close that task in the legacy system as "Completed".&amp;nbsp; If it terminates, we marked it as "Cancelled".&amp;nbsp; &amp;nbsp;This all works just fine, unless the process is terminated by terminating it's parent Call Activity!&amp;nbsp; Since the listener point doesn't fire...we have no way to know it's over and grab that subprocess variable to handle it.&amp;nbsp; Interestingly, any open tasks in that subprocess DO fire the &lt;STRONG&gt;ACTIVITY&lt;/STRONG&gt;_CANCELLED with a type of userTask.&amp;nbsp; And so do other callActivity types.&amp;nbsp; My conclusion is that this is a 5.18 bug.&amp;nbsp; Unless it's by design?&amp;nbsp; If so, why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me note here, that this IS indeed a cancel event:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;boundaryEvent id="boundarymessage1" name="Message" attachedToRef="callActivity1" cancelActivity="true"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;messageEventDefinition messageRef="testKillMessage"&amp;gt;&amp;lt;/messageEventDefinition&amp;gt;&lt;BR /&gt; &amp;lt;/boundaryEvent&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;After hours of trying to solve this, I came up with another potential solution but, in the end, could not make it work.&amp;nbsp; Since the ACTIVITY_CANCELLED fires for the Call Activity (element), okay...I'll just grab the process variables from the subprocess that it instantiated.&amp;nbsp; We know when the subprocess ends, that the Call Activity that fired it is completed and flow moves on to the next element.&amp;nbsp; Somehow the parent process' Call Activity is linked to the subprocess instantiation to enable this natively.&amp;nbsp; But, while there are 4000 questions online about how to get the parent process ID from the child process...how do you go the other way?&amp;nbsp; How does one ask "I have this Call Activity...what was the processInstanceId of the subprocess?"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've struggled with this for days.&amp;nbsp; I'm not a Java guy, but a decent programmer.&amp;nbsp; I can explore Javadocs with the best of us, and using Eclipse really helps me on the object class insights.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could really use some help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The end goals are any of the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;How to get the PROCESS_CANCELLED to fire for the subprocess instance when the Call Activity is terminated?&lt;/LI&gt;&lt;LI&gt;How to determine the sub-processInstanceId spawned by the Call Activity in the parent process?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eagerly awaiting some insight from others.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Aug 2018 13:52:23 GMT</pubDate>
    <dc:creator>willb</dc:creator>
    <dc:date>2018-08-29T13:52:23Z</dc:date>
    <item>
      <title>Activiti 5.22: Message-Cancelled Call Activity doesn't fire subprocess PROCESS_CANCELLED</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/activiti-5-22-message-cancelled-call-activity-doesn-t-fire/m-p/40133#M16826</link>
      <description>(Title originally indicated v5.18, but we are on 5.22).When a process instance ends via an end event a PROCESS_COMPLETE listener event fires.&amp;nbsp; If the process hits a terminate end event PROCESS_CANCELLED fires.When that subprocess is the result of a Call Activity and the Call Activity receives a boun</description>
      <pubDate>Wed, 29 Aug 2018 13:52:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/activiti-5-22-message-cancelled-call-activity-doesn-t-fire/m-p/40133#M16826</guid>
      <dc:creator>willb</dc:creator>
      <dc:date>2018-08-29T13:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Activiti 5.22: Message-Cancelled Call Activity doesn't fire subprocess PROCESS_CANCELLED</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/activiti-5-22-message-cancelled-call-activity-doesn-t-fire/m-p/40134#M16827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With no response from either Alfresco or the community regarding this question, we did arrive at a solution.&amp;nbsp; That solution, however, is horribly ugly in my opinion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What we did was add a manual input variable to&amp;nbsp;&lt;EM&gt;every&lt;/EM&gt; Call Actvity where the subprocess is an "order" and will contain our completeEventTrackingId.&amp;nbsp; &amp;nbsp;That variable is something like "parentCallActivityElementId" and contains the same ID as that Call Activity element, obviously.&amp;nbsp; For example, if the element ID is "subCompleteTitleOrder", then we'll have an input variable of parentCallActivityElementId="subCompleteTitleOrder".&amp;nbsp; This requires all of our BPM developers to perform this extra design step.&amp;nbsp; (Yes, we could modify the XML at deployment time, but we aren't quite there yet.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When "PROCESS_START" fires on the subprocess, we look for a process variable named "parentCallActivityElementId".&amp;nbsp; If it is found, we retrieve the parent process, and create a variable that follows the convention, in this case, of subCompleteTitleOrder&lt;STRONG&gt;_pid&lt;/STRONG&gt; and store the&amp;nbsp;&lt;EM&gt;subprocess'&amp;nbsp;&lt;/EM&gt;processInstanceId on it.&amp;nbsp; Note that the convention is "parent Call Activity element ID" plus underscore plus "pid" to hold that value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the parent Call Activity is&amp;nbsp;&lt;EM&gt;cancelled &lt;/EM&gt;(either by a boundary event or by the parent process being canceled), the listener point "ACTIVITY_CANCELLED" does fire for any &lt;EM&gt;open, unfinished&lt;/EM&gt;&amp;nbsp;elements.&amp;nbsp; We check to see if it's of the Call Activity type and, if so, we grab that element ID, then look for convention-based "thatId_&lt;EM&gt;pid"&lt;/EM&gt; process variable (in this case: "&lt;SPAN&gt;subCompleteTitleOrder&lt;/SPAN&gt;&lt;STRONG&gt;_pid")&lt;/STRONG&gt; in the containing process.&amp;nbsp; If it's found, then we can grab (either from live or historical process search) for that sub-processInstanceId, look for the completeEventTrackingId variable on that subprocess... and fire our postProcessEnded() custom function that closes that task ID in the legacy system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of points here that I can see for improvement for Activiti:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;When a process is cancelled, regardless of how it is spawned (Process self-terminates, Call Activiti cancelled, Parent Process is cancelled, boundary events, etc.) that PROCESS_CANCELLED is fired.&amp;nbsp; In our opinion, this is a bug, that cancelled Call Activities don't fire PROCESS_CANCELLED on their spawned subprocesses.&lt;/LI&gt;&lt;LI&gt;It would nice if there was a way to be able to configure the input/output variables for a Call Activity at runtime.&amp;nbsp; If there's a way, we couldn't find it.&lt;/LI&gt;&lt;LI&gt;We know that when a subprocess ends, that control is returned to the parent process and the Call Activity ends and the flow moves on.&amp;nbsp; There is&amp;nbsp;&lt;EM&gt;obviously&lt;/EM&gt; a connection between a Call Activity and it's spawned process.&amp;nbsp; But there seems to be no way at runtime to obtain the spawned sub-processInstanceId.&amp;nbsp; At least not that is publicly exposed.&amp;nbsp; Adding the abiltity to ask the Call Activity, when it ends, "what was the processInstanceId of the process you spawned?" would be mighty helpful.&amp;nbsp; Or even to have access to the sub-process' variables would be even better, without having to specifically create an output variable, which, again, seems impossible to modify at runtime.&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Sep 2018 16:31:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/activiti-5-22-message-cancelled-call-activity-doesn-t-fire/m-p/40134#M16827</guid>
      <dc:creator>willb</dc:creator>
      <dc:date>2018-09-13T16:31:35Z</dc:date>
    </item>
  </channel>
</rss>

