I created a CPF on insert and update of documents. These CPF pipelines create multiple xdmp:spawn-tasks to perform variety of tasks. I have couple of questions with this approach.
- Some of the spawned tasks will modify the original document. Will this trigger the update workflow of CPF? I can use a flag on the document that will indicate that it is an update from the spawned task. But is there a more elegant way to do this ?
- Do I need to worry about deadlock? I mean if two tasks that were spawned from same CPF try to update the same document same time, how can I avoid this?
Basically I am trying to use envelope pattern for my inserted documents and wrap all the artifact documents into one single document. The reason I am using CPF to generate this artifact documents is that I can dump documents using MLCP or any other way into the database, and let CPF worry about the processing, instead of using a custom REST endpoint and having all the document ingest through this custom REST endpoint.