incubator-kie-kogito-runtimes icon indicating copy to clipboard operation
incubator-kie-kogito-runtimes copied to clipboard

PUT request for process instance with partial updates

Open doogle-oss opened this issue 3 years ago • 11 comments
trafficstars

Description

When updating process instance we have to get the entire payload and modify and then send via put request. Need to have a option for partial update.

Lets assume the below payload { "var1": "test", "var2": { "var3": "t1", "var4": "t4" } }

In order to update var1 we do the following

  1. GET /processinstanceid
  2. Update the payload for var1 to "test2"
  3. PUT /processinstanceid

We can actually have option to only update the keys that are in the payload of PUT call. viz. PUT /processinstanceid {"var1":"test2"}

Implementation ideas

Provide a parameter to do partial update and kogito runtime takes care of partial update only to the variable in the payload. Can you please let us know how to ensure that kogito do not mark other variables null if they are not in payload.

doogle-oss avatar Jun 05 '22 12:06 doogle-oss

@fjtirado @nmirasch @evacchi is there any option in kogito for partial update only to the variables which are in the payload.

doogle-oss avatar Jun 05 '22 12:06 doogle-oss

Hi All , Can some one guide on this please. How to do updates to a process instance for example only one variable to udpate instead of all the data in payload.

doogle-oss avatar Jun 10 '22 20:06 doogle-oss

Hi Team any update on this please.. Need some help on this.

doogle-oss avatar Jun 30 '22 16:06 doogle-oss

Its been 25 days now and there is no response yet on this.

doogle-oss avatar Jun 30 '22 16:06 doogle-oss

@evacchi @nmirasch can you please advise on this. Did not find anything on this.

doogle-oss avatar Jul 26 '22 07:07 doogle-oss

@cristianonicolai Can you please advise on this. We have been doing multiple fetch and update. Can we have a option to do partial update of data in processinstance variables.

doogle-oss avatar Aug 03 '22 10:08 doogle-oss

@debu999, you're correct, right now the only way to update variables is to provide the entire payload. Perhaps to assist with a better solution, could you explain the use case? I would expect that manual intervention to update variables should not be a common practice.

cristianonicolai avatar Aug 03 '22 15:08 cristianonicolai

@cristianonicolai There is a requirement to udpate data in the variables of the domain even after the process instance is completed/aborted. This is where we want to use the put call to just udpate the alert domain variables.

doogle-oss avatar Aug 08 '22 05:08 doogle-oss

@debu999 process engine will remove the state of any process once it is completed/aborted. The process instance won't be available for you to update. Usually, the process should not be the place to be the source of truth so for instance, another system would hold the data that a process would use, like customer details or orders. In this scenario, you wouldn't update a process variable, even because you most likely would need to know the data that was used during the process execution.

cristianonicolai avatar Aug 09 '22 07:08 cristianonicolai

@cristianonicolai with regards to patch method in task instance, it doesnot update the domain object. Any pointer why domain object is not updated. I was having opinion that it will update task instance and domain object together.

doogle-oss avatar Aug 10 '22 19:08 doogle-oss

@cristianonicolai does the domain object get changed and how do we link a new process instance to existing domain object

doogle-oss avatar Aug 11 '22 13:08 doogle-oss

https://issues.redhat.com/browse/KOGITO-7713 States its added for the domain object Patch call and will be available in 1.27. Thanks for the quick update. Looking forward to it.

doogle-oss avatar Aug 12 '22 05:08 doogle-oss

@fjtirado can you guide if updating data via user task instance will also update the data model.

doogle-oss avatar Aug 12 '22 05:08 doogle-oss

@debu999 Please take a look to https://blog.kie.org/2021/05/kogito-user-tasks-process-api.html

fjtirado avatar Aug 26 '22 07:08 fjtirado

@debu999 Please take a look to https://blog.kie.org/2021/05/kogito-user-tasks-process-api.html

I believe we have a patch method introduced to domain for process instance updates. But patch is not added for tasks. Do advice if that will be a new jira to track it. Patch for process instance is added in 1.27.0.Final version.

doogle-oss avatar Aug 26 '22 10:08 doogle-oss