Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Included Action Modules

Anthony Clavio edited this page Nov 24, 2020 · 7 revisions

The MarkLogic State Conductor includes several out-of-the-box action modules. These action modules can be invoked as a Resource in Task states.


Common Actions

Add a collection to a document

/state-conductor/actions/common/examples/add-collections.sjs

Adds the provided collection(s) to the in-process document.

Parameters:

  • collections - (Array) the collection(s) to add
{
  "Type": "Task",
  "Comment": "adds a collection to the document",
  "Resource": "/state-conductor/actions/common/examples/add-collections.sjs",
  "Parameters": {
    "collections": ["my-collection"]
  }
}

Split a text document

/state-conductor/actions/common/text-file-splitter.sjs

Splits a delimited text document into individual files. The split files are persisted using the supplied configurations. The content of the in-process document must be a text node, otherwise an exception will be raised.

Parameters:

  • delimiterPattern - (String) The pattern used for splitting the source document's content. Defaults to "\n".
  • skipHeader - (Boolean) If the first line of content should be skipped. Defaults to true.
  • skipTrailingEOF - (Boolean) If the final empty line of content should be skipped. Defaults to false.
  • targetPrefix - (String) Directory prefix to use when saving the split documents. Defaults to the in-process document's uri.
  • targetExtension - (String) File extension to use when saving the split documents. Defaults to ".txt".
  • targetCollections - (Array) List of collections to apply to the split documents.
{
  "Type": "Task",
  "Comment": "splits a text document into individual files",
  "Resource": "/state-conductor/actions/common/text-file-splitter.sjs",
  "Parameters": {
    "delimiterPattern": "\n",
    "skipHeader": true,
    "skipTrailingEOF": true,
    "targetPrefix": "/splits",
    "targetExtension": ".txt",
    "targetCollections": ["my-collection"]
  }
}

Data Hub Framework Actions

Invoke a DHF Flow (Full)

/state-conductor/actions/common/dhf/dhf5RunFlowAction.sjs

Runs the named Data Hub Framework 5 flow on the in-process document. Each step of the named flow is executed in sequence; within its own transaction. The result of each step is saved to the Context of the State Conductor Execution document.

Parameters:

  • flowName - (String) The DHF flow name.
  • flowOptions - (Object) JSON options to pass to the DHF flow.
{
  "Type": "Task",
  "Comment": "runs the dhf 5 flow named 'testFlow'",
  "Resource": "/state-conductor/actions/common/dhf/dhf5RunFlowAction.sjs",
  "Parameters": {
    "flowName": "testFlow",
    "flowOptions": {
      "param": "Hello World"
    }
  }
}

Invoke a DHF Flow Step

/state-conductor/actions/common/dhf/dhf5RunFlowStepAction.sjs

Runs the given step of a Data Hub Framework 5 flow on the in-process document. The result of the step is saved to the Context of the State Conductor Execution document.

Parameters:

  • flowName - (String) The DHF flow name.
  • step - (Number) The step number to be executed.
  • flowOptions - (Object) JSON options to pass to the DHF flow.
{
  "Type": "Task",
  "Comment": "runs the dhf 5 flow named 'testFlow', step #1",
  "Resource": "/state-conductor/actions/common/dhf/dhf5RunFlowStepAction.sjs",
  "Parameters": {
    "flowName": "testFlow",
    "step": 1,
    "flowOptions": {
      "param": "Hello World"
    }
  }
}

Create a document envelope

/state-conductor/actions/common/dhf/dhf5MakeEnvelopeStep.sjs

Executes the Data Hub Framework 5 "Make Envelope" function on the in-process document.

Parameters:

  • collections - (Array) List of collection to be applied to the in-process document.
{
  "Type": "Task",
  "Comment": "runs the dhf 5 flow named 'testFlow', step #1",
  "Resource": "/state-conductor/actions/common/dhf/dhf5MakeEnvelopeStep.sjs",
  "Parameters": {
    "collections": ["my-collection"]
  }
}