我使用的是MarkLogic CPF。
我已经为以下三个州配置了CPF
http://marklogic.com/states/initial
http://marklogic.com/states/updated
http://marklogic.com/states/deleted
当initial & updated状态时,一切正常
但是当我删除一个文档时,CPF没有执行配置的模块。
请在管道配置下面找到(只粘贴删除状态)
<state-transition>
<annotation>
when document is deleted in 'abc' collection
</annotation>
<state>http://marklogic.com/states/deleted</state>
<on-success>http://marklogic.com/states/done</on-success>
<on-failure>http://marklogic.com/states/error</on-failure>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>head</root-element>
<namespace>https://www.head.org/Schema/head/hd</namespace>
</options>
</condition>
<action>
<module>delete-record.xqy</module>
</action>
</execute>
</state-transition>CPF配置为abc集合。
删除以根节点为head、命名空间为https://www.head.org/Schema/head/hd的文档时
delete-record.xqy模块没有被执行。
请帮助我找到问题,如果需要更多细节请告诉我。
更新:
完整管道配置
<pipeline xmlns="http://marklogic.com/cpf/pipelines">
<pipeline-name>Combined Search</pipeline-name>
<pipeline-description>Make a single copy</pipeline-description>
<success-action>
<module>/MarkLogic/cpf/actions/success-action.xqy</module>
</success-action>
<failure-action>
<module>/MarkLogic/cpf/actions/failure-action.xqy</module>
</failure-action>
<state-transition>
<annotation>
on creation
</annotation>
<state>http://marklogic.com/states/initial</state>
<on-success>http://marklogic.com/states/done</on-success>
<on-failure>http://marklogic.com/states/error</on-failure>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>head</root-element>
<namespace>https://www.head.org/Schema/head/hd
</namespace>
</options>
</condition>
<action>
<module>create-full-record.xqy</module>
</action>
</execute>
</state-transition>
<state-transition>
<annotation>
on update
</annotation>
<state>http://marklogic.com/states/updated</state>
<on-success>http://marklogic.com/states/done</on-success>
<on-failure>http://marklogic.com/states/error</on-failure>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>head</root-element>
<namespace>https://www.head.org/Schema/head/hd
</namespace>
</options>
</condition>
<action>
<module>update-record-biblio.xqy</module>
</action>
</execute>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>media</root-element>
<namespace>https://www.media.org/Schema/Media/md</namespace>
</options>
</condition>
<action>
<module>update-media.xqy</module>
</action>
</execute>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>tracking</root-element>
<namespace>https://www.tracking.org/Schema/Tracking/tr</namespace>
</options>
</condition>
<action>
<module>update-tracking.xqy</module>
</action>
</execute>
</state-transition>
<status-transition>
<annotation>
on deletion
</annotation>
<status>deleted</status>
<on-success>http://marklogic.com/states/done</on-success>
<on-failure>http://marklogic.com/states/error</on-failure>
<always>true</always>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>head</root-element>
<namespace>https://www.head.org/Schema/head/hd
</namespace>
</options>
</condition>
<action>
<module>delete-record.xqy</module>
</action>
</execute>
</status-transition>
</pipeline>对文档的创建、更新和删除不执行任何操作。请帮助我找出我正在做的错误。
我已经将两条管道连接到了域上。
以上一位& Status Change Handling
更新:
分析:
我在namespace-condition.xqy文件中放了一个日志。删除上述文件时,将调用该文件,当我检查fn:doc-available($cpf:document-uri)时,它将返回false。这意味着文档已经消失(删除),因此没有触发器。
对于status-transition & state-transition,它不起作用,请帮助我理解错误以及如何解决它。
发布于 2017-06-30 14:28:34
州名本身就没有意义。如果您查看状态更改处理管道中的定义,您会发现它碰巧在创建时将状态设置为http://marklogic.com/states/initial (与更新类似),但是对于删除,它没有设置状态,而是运行一个操作。如果您希望自己的操作响应删除,则需要状态转换,而不是状态转换。类似于:
<status-transition>
<annotation>
Do some extra work.
</annotation>
<status>deleted</status>
<priority>5000</priority>
<always>true</always>
<execute>
<condition>
<module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
<root-element>head</root-element>
<namespace>https://www.head.org/Schema/head/hd</namespace>
</options>
</condition>
<action>
<module>delete-record.xqy</module>
</action>
</execute>
除了在状态更改处理管道中的正常删除处理之外,“始终”还要求这样做。
发布于 2017-07-13 16:35:35
您是否将状态更改处理管道附加到您的域?它负责处理创建和更新的状态事件,以设置这些状态,以便状态转换能够响应。
https://stackoverflow.com/questions/44847679
复制相似问题