<?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 Re: Reusing Java Tasks with different configuration in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169244#M122650</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I may, and if the BPMN specs don't forbid it (sorry, I don't know them), why not add a sort of optional "force reassign" config on tasks so that every time it's executed, the expressions get reassigned before execution so that it may "mock" a "multiple instance" scenario for the Java Class?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unless another nicer (more intuitive) approach would be add an optional config (like activiti:async), say activiti:reuse=false so that more than one instance of the same class can be created (it won't work with spring beans UNLESS the beans are picked from a factory that can create more instance on request)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Uhm… while I was writing this last one sentence I have to explore if spring support such thing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Apr 2014 11:39:02 GMT</pubDate>
    <dc:creator>lmollea</dc:creator>
    <dc:date>2014-04-24T11:39:02Z</dc:date>
    <item>
      <title>Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169240#M122646</link>
      <description>I have a modeling problem, I need to reuse a Java Service Task twice (or more) in the same process, passing him some "parameters" that alter slightly the behaviour.Basically I will receive a signal from the outside that will tell a process instance that an event has happened (basically a file receiv</description>
      <pubDate>Tue, 01 Apr 2014 13:38:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169240#M122646</guid>
      <dc:creator>lmollea</dc:creator>
      <dc:date>2014-04-01T13:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169241#M122647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why do you need to use expressions there, wouldn't it be more logical to depend on some other Spring beans for that? In that case, you don't have the issue that expressions are static. Of course, the actual runtime behaviour can only consult those dependent beans when they are actually needed rather than on creation time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or am i completely misunderstanding your problem?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 20:34:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169241#M122647</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-04-01T20:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169242#M122648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Image worth a thousand words (sorry I could have added this before)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[img]&lt;/SPAN&gt;&lt;A href="http://s28.postimg.org/hamsam4d9/multitask.png" rel="nofollow noopener noreferrer"&gt;http://s28.postimg.org/hamsam4d9/multitask.png&lt;/A&gt;&lt;SPAN&gt;[/img]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue: logic for handling file in both "Handle File 1" and "Handle File 2" is the same. What changes is the configuration that such code needs. What I have to do is make sure that when the logic for "Handle File 1" and "Handle File 2" are invoked they know which leg of the process they are on and act accordingly (basically, they need a pointer to a config that's in a database they have to retrieve).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For both tasks, we used a spring bean pointed by a delegate expression (${fileLoaderTask}), on "Handle File 1" we set a "config" field to the "File 1" value, while on "handle File 2" we set the same field ("config") to "File 2". In this scenario, we had only one ${fileLoaderTask} instance (not a bad thing per se) but the value of "name" field was set to the last one that the engine set, so both legs ended getting either "File 1" or "File 2", depending probably on the parsing order in the XML.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't create specialized beans for the two different legs, given the number of processes we have, we may end up creating thousands of beans in the spring context and it's not advisable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also cannot merge the different tasks into one as the two handle file tasks are in the middle of different, unmergeable process flows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the moment we solved by changing the delegate expression to ${fileLoaderTaskFactory.createTask("…")} using a factory bean that creates instances of FileLoaderTask each pointing to a different config. It's not optimal if each time a new fileLoaderTask instance gets create, but it's working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Point is: is there a better way to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 09:16:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169242#M122648</guid>
      <dc:creator>lmollea</dc:creator>
      <dc:date>2014-04-02T09:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169243#M122649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't see a better way to do it … maybe store the config in variables and let the beans use those variables? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Altough i don't really like that approach either … hmmm good use case.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 08:22:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169243#M122649</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-04-22T08:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169244#M122650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I may, and if the BPMN specs don't forbid it (sorry, I don't know them), why not add a sort of optional "force reassign" config on tasks so that every time it's executed, the expressions get reassigned before execution so that it may "mock" a "multiple instance" scenario for the Java Class?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unless another nicer (more intuitive) approach would be add an optional config (like activiti:async), say activiti:reuse=false so that more than one instance of the same class can be created (it won't work with spring beans UNLESS the beans are picked from a factory that can create more instance on request)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Uhm… while I was writing this last one sentence I have to explore if spring support such thing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 11:39:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169244#M122650</guid>
      <dc:creator>lmollea</dc:creator>
      <dc:date>2014-04-24T11:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing Java Tasks with different configuration</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169245#M122651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Spring approach might work if you let it implement a FactoryBean interface I believe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to summarize: java service classes are cached, but you can always inject through expressions that are resolved at runtime.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 07:56:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-java-tasks-with-different-configuration/m-p/169245#M122651</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-04-25T07:56:02Z</dc:date>
    </item>
  </channel>
</rss>

