TeamBinder Connector 25.4
TeamBinder Connector Help

# Run a Lua Script after Ingestion

You can configure the connector to run a Lua script after batches of documents are successfully sent to the ingestion server. This can be useful if you need to log information about documents that were processed, for monitoring and reporting purposes.

To configure the file name of the Lua script to run, set the `IngestBatchActions` configuration parameter in the connector's configuration file.

- To run the script for all batches of documents that are ingested, set the parameter in the `[Ingestion]` section.

- To run the script for batches of documents retrieved by a specific task, set the parameter in the `[TaskName]` section.

  NOTE: If you set the parameter in a `[TaskName]` section, the connector does not run any scripts specified in the `[Ingestion]` section for that task.

For example:

    [Ingestion]
    IngestBatchActions0=LUA:./scripts/myScript.lua

For more information about this parameter, refer to the TeamBinder Connector Reference.

The Lua script must have the following structure:

    function batchhandler(documents, ingesttype)
       ...
    end

The `batchhandler` function is called after each batch of documents is sent to the ingestion server. The function is passed the following arguments:

Argument | Description
--- | ---
`documents` | A table of document objects, where each object represents a document that was sent to the ingestion server. A document object is an internal representation of a document. You can modify the document object and this changes the document. However, as the script runs after the documents are sent to the ingestion server, any changes you make are not sent to CFS or your Content component.
`ingesttype` | A string that contains the ingest type for the documents. The `batchhandler` function is called multiple times if different document types are sent.

For example, the following script prints the ingest type (`ADD`, `DELETE`, or `UPDATE`) and the reference for all successfully processed documents to `stdout`:

    function batchhandler(documents, ingesttype)
         for i,document in ipairs(documents) do
             local ref = document:getReference()
             print(ingesttype..": "..ref)
         end
     end

Copyright 2025 Open Text
Version 25.4 | Last updated October 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery TeamBinder Connector 25.4

Topic Title: Run a Lua Script after Ingestion