Task is out of date, please refresh

hi All,

From MWS Task API, I am using applyChanges() method on custom task to update Task Data and Task Info.

Often I am getting an error ‘Task is out of date, Please refresh’ and the task Data, task info updation is being failed.

I am not able to identify the root cause of this issue as I am getting this exception intermittently (with out any deployments of my code in between).

Could you please let me know if you have any inputs on this issue?

Kind regards,
Raja sekhar Kintali

Hi Raja,

for me this sounds like a optimistic locking issue.

Could it be that someone else updated the task after you read it but before you try to update:

  1. You read the task
  2. Someone else (maybe the MWS Task Engine through event handler) updates the task.
  3. You try to update the task.

The TaskInfo Document has a attribute taskVersionNumber you should have a look at - are you passing this attribute when you try to update a task?

You find the following explanation in the documentation (8-0-SP1_Task_Engine_API_and_Service_Reference.pdf)

Hope that helps.

Regards,
Mathias

hi Mathias,

Thank you for the reply.

The quote says that, ‘taskVersionNumber’ can be used to check if the task is out of sync.

But as we are using webMethods 7.1.2 version, taskVersionNumber is not available in TaskInfo. Hence, as a workaround I implemented my code in the following way.


if (Task is out of date error occured){
        call applyChanges method of MWS Task API one more time.
}

This second time call successfully updated Task details to database.

Though it resolved the issue, I am still not clear, why the second time call didn’t give exception ‘Task is out of Date, Please refresh’.

Could you please let me know if you have any inputs on this?

Kind regards,
Raja sekhar Kintali