incubator-kie-kogito-runtimes
incubator-kie-kogito-runtimes copied to clipboard
PUT request for process instance with partial updates
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
- GET /processinstanceid
- Update the payload for var1 to "test2"
- 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.
@fjtirado @nmirasch @evacchi is there any option in kogito for partial update only to the variables which are in the payload.
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.
Hi Team any update on this please.. Need some help on this.
Its been 25 days now and there is no response yet on this.
@evacchi @nmirasch can you please advise on this. Did not find anything on this.
@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.
@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 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.
@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 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.
@cristianonicolai does the domain object get changed and how do we link a new process instance to existing domain object
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.
@fjtirado can you guide if updating data via user task instance will also update the data model.
@debu999 Please take a look to https://blog.kie.org/2021/05/kogito-user-tasks-process-api.html
@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.