[MarkLogic Dev General] prevent CPF updated doc from getting into CPF

Mary Holstege mary.holstege at marklogic.com
Sat Mar 17 08:59:29 PDT 2012


On Sat, 17 Mar 2012 05:55:47 -0700, Mihir Das <mihir.kumar999 at gmail.com> wrote:

> Hi All,
>
> I have a CPF pipeline in which whenever document is created/updated it enters into intial state and goes through each CPF steps.Now, i wanted to update the existing content based upon the incoming content.
>
> e.g if A doc arrives then update A&B doc & when B arrives then update A&B.
>
> this drives me into some infinite loop.e.g A status=created , B status=updated then B as its staus is updated it enters into pipeline B status = created , A status=Updated and the loop goes on!!
>
> is there any way to stop the pipeline updated doc from entering into pipeline again? i have tried using cpf:document-set-processing-status=done & cpf:document-set-state=final but its throws error of multiple update conflict. As i have performred (node-replace,Set-processing-status,set-state) on B. but if i do (node-replace,Set-processing-status) then it doesn't throw error but B again enters into pipeline as active status.
>
> Thanks,
> Mihir
>


This is going to be very tricky, but it is possible.

A partial model to follow is the XInclude pipeline,
which has to be able to handle a change to a part
or to a master and update accordingly.

What you need is some other (non-CPF) property
that your application sets that you can check
to see whether you should do the reprocessing
or not. Then you need a condition for your
reprocessing action that interrogates this.

If the processing only needs to happen on
created documents but not on updated ones,
then you can change the pipelines to put
updated documents in a different state with
different processing. The state
http://marklogic.com/states/initial is
not magic or special in any way; it's
just a name.

If you want the processing to happen for
updates and new content the same way, then
you'll probably need an application-level
timestamp.  CPF defines cpf:last-updated
and a built-in action
/MarkLogic/cpf/actions/set-property-updated-action.xqy
that sets it, that you can use for this purpose.

//Mary

Mary.Holstege at marklogic.com
Principal Engineer
Mark Logic Corporation


More information about the General mailing list