本文介绍了Marklogic CPF策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于集合中文档的插入/更新操作,我已打开CPF.我想确保在我的CPF中,如果我修改另一个文档,我不希望它被添加到CPF队列中.我该如何实现?

For an insert/update operation on a document in a collection, I have CPF turned on. I want to make sure in my CPF, if I modify another document, I donot want it to get added the CPF queue. How can I achieve this ?

例如: 说在我的CPF队列中我有后续文件

For eg: say in my CPF queue I have followwing documents

d1,d2,d3,d4,d5

在我的CPF任务中说d1,我不得不更新文档d4.我需要设置什么CPF状态,以使d4不会添加到CPF队列的末尾..但是d4如果已经存在于队列中,则应继续进行常规CPF程序.

Say in my CPF task ford1, I had to update document d4. What CPF state do I need to set so that d4 will not be added to the end of CPF queue.. but d4 if already present in the queue, should continue with regular CPF process.

可以做到吗?如果是这样,那么遵循的好策略是什么.

Can this be done ? if so what would be a good strategy to follow.

推荐答案

如果CPF已更新并且在域范围内,它将始终在d4上自动触发,但是该框架包含确保仅此代码的代码.一次以一种状态处理文档.因此,它拾取d4并开始对其进行处理,然后触发另一个d4触发器,该触发器最终将无所事事.我认为构图的方式是:一旦处理了d4,如何对其进行标记,以便不再进行处理?如果它正在进行中,则无需担心.如果它已经完成,则需要将其置于终端状态(即在任何相关管道中都没有过渡的状态).

CPF will always automatically trigger on d4 if it is updated and it is in the scope of the domain, but the framework includes code to make sure that it is only working on a document in one state at a time. So it picks up d4 and starts working on it, and then another d4 trigger fires, that trigger will end up doing nothing. I think the way to frame this is: once d4 is processed, how can I mark it so it doesn't get processed again? If it is in-process, you don't need to worry about it. If it is in completed process, you need to put it in a terminal state (i.e. a state that has no transition in any relevant pipeline).

如果您尝试以不应该触发它的方式更新d4,这意味着您要在第一次触发d4的工作上设置竞赛条件,我不建议您尝试这样做.真的很难弄清楚所有比赛条件.

If you try to update d4 in a way that it shouldn't be triggered, all that means is you set up a race condition on the work done on the first triggering of d4, and I would not recommend trying to do that. It is really hard to puzzle out all the race conditions.

这篇关于Marklogic CPF策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 09:42