IDocumentEnrichmentHandler

The IDocumentEnrichmentHandler interface allows you to create "enrichment" logic for manipulating document data asynchronously using the Document enrichment task in the Task Daemon.  Configure that task to run when you want, and assign an implementation of the IDocumentEnrichmentHandler interface to to.

The InitializeAsync() method will be called when the task starts.  This allows you to do some initialization, like fetching data from external services.

The EnrichAsync() method will then be called for each document in the model.  This allows you to update the document data.

Finally, the FinalizeAsync() method will be called, which allows you to perform some cleanup if required, or to send a notification to someone that the enrichment handler has been executed.

Interface declaration

public interface IDocumentEnrichmentHandler
{
	Task InitializeAsync(DocumentModel model);
	Task EnrichAsync(Document document);
	Task FinalizeAsync(DocumentModel model);
}

Example

No example available.

Registration

This is how the implementation is registered into the DI container in Veva, this should be done in your module config file (The class which implements IModule).

public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
	services.AddNamed<IDocumentEnrichmentHandler, YourEnrichmentHandler>(ServiceLifetime.Transient);
}