public interface DocumentWorker extends AutoCloseable
When integrated into the Data Processing pipeline the Document Worker implementation is passed a defined subset of the fields that the document has. It is able to add, remove, or update the document's fields.
The fields that are passed to the Document Worker are defined in the Data Processing Action that is added to the workflow. It is possible to pass all of the document's fields to the worker.
The Document Worker may implement the BulkDocumentWorker interface instead of implementing this interface if there would be
efficiency gains to be made by processing multiple documents together. The BulkDocumentWorker interface extends this interface
so the methods of this interface must still be implemented.
| Modifier and Type | Method and Description |
|---|---|
void |
checkHealth(HealthMonitor healthMonitor)
This method provides an opportunity for the worker to report if it has any problems which would prevent it processing documents
correctly.
|
default void |
close()
This method will be called when the worker is shutting down.
|
void |
processDocument(Document document)
Processes a single document.
|
void checkHealth(HealthMonitor healthMonitor)
healthMonitor - used to report the health of the applicationvoid processDocument(Document document) throws InterruptedException, DocumentWorkerTransientException
document - the document to be processedInterruptedException - if any thread has interrupted the current threadDocumentWorkerTransientException - if the document could not be processeddefault void close()
throws Exception
It should be overridden by workers which hold resources that need to be released.
close in interface AutoCloseableException - if the worker's resources cannot be closedCopyright © 2015–2017 Hewlett Packard Enterprise Development LP. All rights reserved.