cpf:check-transition( $docid as xs:string, $transition as element(*, p:transition)? ) as xs:boolean
Verify that the current transition is the correct one for the document. If a document is touched from multiple threads certain race conditions may apply that will cause the lookup of the transition to end up out of sync with the transition action when it is actually executed. In this case the action should do nothing; not even call cpf:success or cpf:failure. Some other CPF thread has already done the work on this document.
Parameters | |
---|---|
docid | The URI of the document. |
transition | The pipeline transition being executed. |
xquery version "1.0-ml"; import module namespace cpf = "http://marklogic.com/cpf" at "/MarkLogic/cpf/cpf.xqy"; declare variable $cpf:document-uri as xs:string external; declare variable $cpf:transition as node() external; if (cpf:check-transition( $cpf:document-uri, $cpf:transition )) then try { do-my-work(), cpf:success( $cpf:document-uri, $cpf:transition, () ) } catch ($e) { cpf:failure( $cpf:document-uri, $cpf:transition, $e, () ) } else ()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.