<?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 about the process instance business key in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61388#M38102</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;I think that the business key concept in Activiti needs to be clarified. Currently there are 2 restrictions in Activiti with regards to this key AFAICT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) there cannot be 2 active process instances with the same business key:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;alter table ACT_RU_EXECUTION&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add constraint ACT_UNIQ_RU_BUS_KEY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unique(PROC_DEF_ID_, BUSINESS_KEY_);&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;2) the process history is not capable of recording 2 instances of the same process definition with the same business key&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;alter table ACT_HI_PROCINST&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add constraint ACT_UNIQ_HI_BUS_KEY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unique(PROC_DEF_ID_, BUSINESS_KEY_);&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;In a way this is already conflicting IMO. I can start a process instance with key abc, complete it and then start a new one with the same key, but won't be able to complete() it because the history auditing will throw a unique key violation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, conceptually, what is the business key meant to be used for ? If we should use it to assign an application level reference to the process instance, why is it so restrictive ? IMO Activiti should not make any assumption for a business process and just let it start a process with whatever it thinks is meaningful for the business key. If the business allows starting 2 process instances for the same business entity so be it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the other hand, if Activiti insists on having unique business keys per process instance it should not allow us to start the process in the first place. That would require a (potentially expensive) history lookup on each process start, which is not ideal either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See also &lt;/SPAN&gt;&lt;A href="http://forums.activiti.org/en/viewtopic.php?f=6&amp;amp;t=2922" rel="nofollow noopener noreferrer"&gt;http://forums.activiti.org/en/viewtopic.php?f=6&amp;amp;t=2922&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Nov 2011 10:02:13 GMT</pubDate>
    <dc:creator>heymjo</dc:creator>
    <dc:date>2011-11-22T10:02:13Z</dc:date>
    <item>
      <title>about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61388#M38102</link>
      <description>Hi,I think that the business key concept in Activiti needs to be clarified. Currently there are 2 restrictions in Activiti with regards to this key AFAICT:1) there cannot be 2 active process instances with the same business key:alter table ACT_RU_EXECUTION&amp;nbsp;&amp;nbsp;&amp;nbsp; add constraint ACT_UNIQ_RU_BUS_KEY&amp;nbsp;&amp;nbsp;&amp;nbsp; un</description>
      <pubDate>Tue, 22 Nov 2011 10:02:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61388#M38102</guid>
      <dc:creator>heymjo</dc:creator>
      <dc:date>2011-11-22T10:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61389#M38103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, we've chosen to implement it in a flexible way in the API, but with restrictions in the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You're right that probably a check should be done if the business key is already available in the history table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Most users don't pass along a self-generated business key, but let Activiti choose one. Then it's working fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 12:45:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61389#M38103</guid>
      <dc:creator>trademak</dc:creator>
      <dc:date>2011-11-23T12:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61390#M38104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I disagree. What is the advantage of having an Activiti generated businesskey if there are other fields to use that are generated by Activiti like process instance id. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The unique constraint does not add anything in most cases and limits a lot in many… What is the problem with dropping the unique constraint. Everything seems to be still working correctly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 18:40:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61390#M38104</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-11-23T18:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61391#M38105</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;We removed ACT_UNIQ_HI_BUS_KEY and everything seems to be working still. I don't think there are assumptions in the Activiti code on ACT_UNIQ_RU_BUS_KEY, but i'm not sure. I will create a few unit tests and see.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2011 09:32:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61391#M38105</guid>
      <dc:creator>heymjo</dc:creator>
      <dc:date>2011-11-24T09:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61392#M38106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;created &lt;/SPAN&gt;&lt;A href="http://jira.codehaus.org/browse/ACT-1230" rel="nofollow noopener noreferrer"&gt;http://jira.codehaus.org/browse/ACT-1230&lt;/A&gt;&lt;SPAN&gt; for this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 11:42:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61392#M38106</guid>
      <dc:creator>heymjo</dc:creator>
      <dc:date>2012-05-25T11:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61393#M38107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see ACT-1230 and it's dupe ACT-997 closed as won't fix, but for my current version of activiti (5.16.4), I don't see ACT_UNIQ_RU_BUS_KEY constraint on ACT_RU_EXECUTION table. Was this constraint dropped in any of the previous releases? What was the motivation behind it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think having this constraint helps in ensuring we don't end up with duplicate process instances in a distributed environment. It is possible to use some kind of distributed locking mechanism when creating process instances to ensure uniqueness and avoid race conditions, but that's complicated. Having business key as unique makes it so much more easier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any other way to achieve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_vinay_ @ zulily&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 22:50:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61393#M38107</guid>
      <dc:creator>funvin</dc:creator>
      <dc:date>2015-01-07T22:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61394#M38108</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;Yes the constraint was dropped. The reason was that there are some cases where the business key is not unique and some cases where you would like it to be unique. So we decided to drop the constraint, because you can always add the constraint manually or do an additional query before creating a process instance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 13:04:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61394#M38108</guid>
      <dc:creator>trademak</dc:creator>
      <dc:date>2015-01-08T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: about the process instance business key</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61395#M38109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem with doing additional query is, there is no way to avoid race condition in a distributed environment without using distributed locks. I can add the constraint, but I am always wary of changing something I don't own and control. If in the future someone upgrades our version of activiti, the constraint could be dropped again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the new semantic of business key is just that it provides domain specific way of efficiently querying (cause it's indexed) the workflow process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_vinay_ @ zulily&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 20:12:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/about-the-process-instance-business-key/m-p/61395#M38109</guid>
      <dc:creator>funvin</dc:creator>
      <dc:date>2015-01-08T20:12:59Z</dc:date>
    </item>
  </channel>
</rss>

