Open topic with navigation
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
To run the script for batches of documents retrieved by a specific task, set the parameter in the
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 more information about this parameter, refer to the HPE Instagram Connector Reference.
The Lua script must have the following structure:
function batchhandler(documents, ingesttype) ... end
batchhandler function is called after each batch of documents is sent to the ingestion server. The function is passed the following arguments:
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 IDOL.
||A string that contains the ingest type for the documents. The
For example, the following script prints the ingest type (
UPDATE) and the reference for all successfully processed documents to
function batchhandler(documents, ingesttype) for i,document in ipairs(documents) do local ref = document:getReference() print(ingesttype..": "..ref) end end