Updating / deleting document files
The documents plugin can also be used to make updates to the files stored for the documents, it is possible to update files or delete them from a document.
Updating the files
Sending the request
- Create a process in which you add a Kafka send event node and a Kafka receive event node (one to send the request, one to receive the reply).
- Configure the first node (Kafka send event) - add a Kafka send action.
- Add the Kafka topic where to send the request:
- Fill in the body message request:
fileId
- the ID of the filecustomId
- the client ID
Kafka topic names can be set by using (overwriting) the following environment variables in the deployment:
KAFKA_TOPIC_FILE_UPDATE_IN:
- default value: ai.flowx.in.qa.document.update.file.v1
KAFKA_TOPIC_FILE_UPDATE_OUT
- default value: ai.flowx.updates.qa.document.update.file.v1
The above examples of topics are extracted from an internal testing environment, when setting topics for other environments, follow the next pattern, for example, ai.flowx.updates.{{environment}}.document.update.file.v1
.
The Engine is listening for messages on topics with names of a certain pattern, make sure to use an outgoing topic name that matches the pattern configured in the Engine.
Receiving the reply
Values expected in the reply body:
- customId = client ID
- fileId = file ID
- documentType = document type
- documentLabel = document label
- minioPath = minio path for the updated file
- downloadPath = download path for the updated file
- error = error description
Example:
{
"customId": "test_763879",
"fileId": 4749,
"documentType": "BULK",
"documentLabel": null,
"minioPath": "qualitance-dev-paperflow-qa-process-id-763879/test_763879/4749_BULK.pdf",
"downloadPath": "internal/files/4749/download",
"noOfPages": null,
"error": null
}
Deleting files from a document
Used to delete files after bulk upload.
Sending the request
- Create a process in which you add a Kafka send event node and a Kafka receive event node (one to send the request, one to receive the reply).
- Configure the first node (Kafka send event) - add a Kafka send action.
- Add the Kafka topic where to send the request:
- Fill in the body message request:
fileId
- the ID of the filecustomId
- the client IDdocumentType
- document type
Kafka topic names can be set by using (overwriting) the following environment variables in the deployment:
KAFKA_TOPIC_FILE_DELETE_IN
- default value: ai.flowx.in.qa.document.delete.file.v1
KAFKA_TOPIC_FILE_DELETE_OUT
- default value: ai.flowx.updates.document.delete.file.v1
The Engine is listening for messages on topics with names of a certain pattern, make sure to use an outgoing topic name that matches the pattern configured in the Engine. :::
Receiving the reply
Values expected in the reply body:
- customId = client ID
- fileId = file ID
- documentType = document type
- error = error description
Example:
{
"customId": "1234_763417",
"fileId": 4747,
"documentType": "BULK",
"error": null
}