<?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 Get name of currently processed activity in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231089#M184219</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to achieve what seems to be an easy task - get currently activity name being processed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an UI which shows currently running process and a progress bar which shows the progress of a ServiceTask.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If activity is something different - eg ScriptTask or a UserTask - it does not show the progress bar but only spinning wheel.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also want to show the current task name being processed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a simple way to achieve it ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought I would set a variable "current-activity" with the name of the activity like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;case ACTIVITY_STARTED:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (ActivitiActivityEvent.class.isAssignableFrom(event.getClass())) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActivitiActivityEvent activitiEvent = (ActivitiActivityEvent) event;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; runtimeService.setVariable(event.getExecutionId(), "current-activity", activitiEvent.getActivityName());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;break;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That code is in a service layer which listens to ActivitiEvent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please keep in mind that UI might be opened by a user in a middle of processing the activiti process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a piece of code on the UI that does:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;(String) activitiService.getRuntimeService().getVariable(execution.getId(), "current-activity"));&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but it seems to be picking up only the previous variable content. I suspect it has to do with the transactions management.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Sep 2016 11:02:10 GMT</pubDate>
    <dc:creator>serid</dc:creator>
    <dc:date>2016-09-05T11:02:10Z</dc:date>
    <item>
      <title>Get name of currently processed activity</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231089#M184219</link>
      <description>Hi All,I am trying to achieve what seems to be an easy task - get currently activity name being processed.I have an UI which shows currently running process and a progress bar which shows the progress of a ServiceTask.If activity is something different - eg ScriptTask or a UserTask - it does not sho</description>
      <pubDate>Mon, 05 Sep 2016 11:02:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231089#M184219</guid>
      <dc:creator>serid</dc:creator>
      <dc:date>2016-09-05T11:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of currently processed activity</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231090#M184220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there a simple way to achieve it ?&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Nope. Transactions, cancellations and multiple executions per process are ruining the whole idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can send notifications to your UI-related in-memory (or DB) storage and persist current activity there. It's important that you send notifications, not use direct listeners, your store should be in different transaction context and/or out of transactions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You should process events of activity/process cancellation, transitions to wait-states etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see similar reporting in unit tests, sometimes activity sequence is wrong &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 15:53:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231090#M184220</guid>
      <dc:creator>warper</dc:creator>
      <dc:date>2016-09-05T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of currently processed activity</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231091#M184221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for your response !&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes - I have already modified my service class so I am buffering the name of currently running activity.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wanted to avoid that on the service layer (don't like to have a state of any service) but cannot find any better way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 16:21:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/get-name-of-currently-processed-activity/m-p/231091#M184221</guid>
      <dc:creator>serid</dc:creator>
      <dc:date>2016-09-05T16:21:54Z</dc:date>
    </item>
  </channel>
</rss>

