open bi server - Custom Batch Job Handler Plugin
The open bi server is extensible with plugins which are .NET DLLs placed in the OPENBI\httpserver\plugins folder. In this article we are going to explore how to create a plugin for adding a custom batch job handler.
Batch job handlers can be configured to run at a certain time, interval or in response to an HTTP request. It is possible to configure the same batch handler multiple times with different parameters.
First create a new .NET library for netstandard2.0 and a references to the open bi server files like OPENBI\ibssolution.bioxRepository.exe. Then add a class which inherits from Ibssolution.biox.Repositoryserver.BatchHandlerBase.
Override the HandlerCode method which should return a constant and unique string which identifies the batch job handler.
Override the HandlerName method which should return a constant string which is used as a dispaly value in the batch job maintenance in the open bi configurator.
Override the AddBatchParametersToCollection method to document which parameters the batch job handler can accept.
Override the Run which is called by the server when the batch job handler is executed. Here are some objects and methods which might be useful:
- job.Parameters: provides access to the configured parameters.
- job.User: provides access to the open bi user for which this batch job handler is executed.
- job.LogWriter: can be used to log information which is automatically stored in the database and can be viewed in the open bi configurator.
For debugging add a custom post build event which automatically copies the DLL to the OPENBI\httpserver\plugins folder. Also use the OPENBI\ibssolution.bioxRepository.exe as starting executable. Because the executable needs to be run as administrator make sure to open the IDE with administrator rights.
It is also possible to reference other NuGet packages as well but make sure that these DLLs are copied directly into the OPENBI folder.
Here is the sample code for creating a plugin which also uses dependency injection to get the ILicense from the open bi server.
Configure a batch job:
Manually execute a batch job and inspecting logs: