Rahul
Rahul

Reputation: 403

How to trigger CPF action module explicitly

I have a document in initial state (http://marklogic.com/states/initial ) and I have configure my CPF pipeline as:

<state-transition>
  <annotation>ready</annotation>
  <state>http://marklogic.com/states/ready</state>
  <on-success>http://marklogic.com/states/completed</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">
        <namespace/>
        </options>
    </condition>
    <action>
      <module>action.xqy</module>
    </action>
  </execute>
</state-transition>

Now, when I change the state of the document using:

cpf:document-set-state("/myDocs/example.xml","http://marklogic.com/states/ready")

The CPF action module action.xqy does not gets executed.

Is there any way I can explicitly change the status of the document and trigger the CPF action module configured for that state?

Upvotes: 4

Views: 345

Answers (1)

mholstege
mholstege

Reputation: 4912

The CPF processing has some code that prevents it from retriggering while it is already active. If you set the log level to "debug" you'll see messages about "check-transition caused skip" that shows you this.

So you need to set the processing-status to "active" as well (in the same transaction as the state change):

cpf:document-set-processing-status("/myDocs/example.xml", "active")

Upvotes: 3

Related Questions