<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Handle Concurrency</title><link>https://community.appian.com/discussions/f/process/11963/handle-concurrency</link><description>Hi, 
 I have a simple process with one user input task to update the reference data / attributes in the DB. There are multiple users who can update the data.I need to handle a concurrency to update the attributes. At any point in time i need to allow</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52977?ContentTypeID=1</link><pubDate>Wed, 28 Feb 2018 11:34:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19612931-74c7-4ba2-a216-33c40768efe3</guid><dc:creator>chandu</dc:creator><description>I agree with Alok comments, the Version attribute will suffice the requirement and thus avoids the additional logic handling from Appain and DB.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52970?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 20:37:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5710590f-0ab7-4d62-b1e1-f3dbb8c88fac</guid><dc:creator>aloks0189</dc:creator><description>&lt;p&gt;Hi Vinay&lt;/p&gt;
&lt;p&gt;As I mentioned earlier, we do have various approaches to resolve a problem statement, &amp;nbsp;in my case I just want to have one row in db which needs to get update always instead of creating one row for each survey, and then performing count of the row. &amp;nbsp;In such case you have to go for @Version annotation.&lt;/p&gt;
&lt;p&gt;Yes, we can have one @Version for each CDT, and that will be more than sufficient to deal with concurrency.&lt;/p&gt;
&lt;p&gt;And we cannot deny the fact is, Appian uses JPA internally to interact with the DB.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/18.1/Supported_XSD_Elements_and_JPA_Annotations.html"&gt;docs.appian.com/.../Supported_XSD_Elements_and_JPA_Annotations.html&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Above link lists out all the annotations of JPA which is supported by Appian. And if you go through the jpa documentation, they have clearly mention that: @Version is specially meant for, Version-Based optimistic concurrency control and that&amp;#39;s what this thread is all about i.e. concurrency management.&lt;/p&gt;
&lt;p&gt;And when your product is giving you this feature OOTB, then I don&amp;#39;t think it makes any sense of dealing with this requirement using manual logic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52962?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 16:30:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8d9f6a8c-c036-47a5-bf32-46b36b41525e</guid><dc:creator>Vinay Kumar Rai</dc:creator><description>&lt;p&gt;HI Alok,&lt;/p&gt;
&lt;p&gt;The @Version annotation can be used on only one field per CDT.&lt;/p&gt;
&lt;p&gt;and Comparison check may require additional call to DB every time&lt;/p&gt;
&lt;p&gt;Concurrency issue can be prevented by good design.&lt;/p&gt;
&lt;p&gt;please refer example below,&lt;/p&gt;
&lt;p&gt;A company wants to have a survey on like and dislike basis. Where they will have only one row on db which will have few columns including likeCount and dislikeCount and one task for each user has been assigned. Where the organisation is having thousands of employees,&lt;/p&gt;
&lt;p&gt;Approach :&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; - Create a new table for User Likes and Dislikes&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; - System Create a new row every time when user like or dislike&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; - please refer the DB structure below&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;table style="height:70px;" width="342"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Id&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;LikeDisLike&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;UserId/Name&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;100012&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;-1&lt;/td&gt;
&lt;td&gt;100013&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;here in the column&amp;nbsp;LikeDisLike, saves the user survey result&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;1&lt;/strong&gt; for&amp;nbsp; &lt;strong&gt;Like&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-1&lt;/strong&gt; for &lt;strong&gt;dislike&lt;/strong&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want the Average or Sum you can early use the aggregate function, and Aggregation is work much faster, and it prevent the concurrency.&lt;/p&gt;
&lt;p&gt;even banks also use the same structure for transactions&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52950?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 12:23:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aa98ba09-3338-456b-8d0a-9303253641e1</guid><dc:creator>aloks0189</dc:creator><description>Hi Vinay&lt;br /&gt;
&lt;br /&gt;
You need to have a version comparison check before writing it to DB in order to avoid the process model node breaks.&lt;br /&gt;
&lt;br /&gt;
This is something which we can deal with. And there are various solution approaches for a particular use case. &lt;br /&gt;
&lt;br /&gt;
And the fact is, @Version is meant for handling the concurrency, if in every single case this lead a process to break, then Appian might not have provided the support for this annotation as part of jpa standards.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#39;s eloborate this point, When you want to assign a task to a group, that means concurrency is not your target. &lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&lt;br /&gt;
 A company wants to have a survey on like and dislike basis. Where they will have only one row on db which will have few columns including likeCount and dislikeCount and one task for each user has been assigned. Where the organisation is having thousands of employees, and every single users like or dislike will update the same row values again and again by increasing its count. &lt;br /&gt;
&lt;br /&gt;
Here in this scenario, assigning the task to a group is not the solution, instead we are trying to bypass the problem. &lt;br /&gt;
&lt;br /&gt;
In fact we should assign one task to each user. Hence here you need to handle the concurrency&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52947?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 12:01:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1335324f-14af-46af-85ff-3b4e6936ca7b</guid><dc:creator>melwyna</dc:creator><description>I guess, we can do above process with a quick task.. As a quick task allows only one task to be active at a time, there is no way that different user can work on simultaneously..&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52943?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 10:39:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c0637ff0-04f6-4c67-ad17-b50699785218</guid><dc:creator>Vinay Kumar Rai</dc:creator><description>Hi.&lt;br /&gt;
&lt;br /&gt;
Using @Version notation on CDT, the WTDB will throw an error when concurrency detected, to start you need to manually start the WTBD,&lt;br /&gt;
The best approach is to assign the task to a group not the particular user, so whenever the task is accepted to any user, the task no longer visible to other users in the group&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52942?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 09:21:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6cea61fc-1c9b-4372-9d83-0c89f4329fe3</guid><dc:creator>aloks0189</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/ravinderl352"&gt;ravinderl352&lt;/a&gt; &amp;nbsp;you can use @Version annotation for those fields on which you want to have locking mechanism enabled.&lt;/p&gt;
&lt;p&gt;For this you need to download the xsd of the corresponding CDT, define @Version annotation this will make sure to release the lock only when one transaction is completed. And in fact you can capture the update version to keep the track of, how many times this row have been modified.&lt;/p&gt;
&lt;p&gt;Hope this will help you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handle Concurrency</title><link>https://community.appian.com/thread/52939?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 07:02:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b23afc99-89aa-4ce9-8328-82685474ff03</guid><dc:creator>Abhay Giri</dc:creator><description>&lt;p&gt;HI Ravi,&lt;/p&gt;
&lt;p&gt;I think you can achieve this by using MNI(Multiple Node Instance) Property . I am assuming here you are assigning the task to a group of people, So you can use MNI and select as below:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/14/J.jpg"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/14/J.jpg" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Abhay&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>