In order to create a LEADTOOLS Cloud Worker it is only necessary to create an assembly whose class derives from the JobBase class. Once a new job is received is received, the windows service will spawn a new process to handle the job. This process will load your worker assembly and call the OnJobReceived Method so that your assembly can begin working on the job. The typical workflow for implementing a worker can be summed up as follows:
Create an assembly that derives from the JobBase class.
Override the OnJobReceived Method to include any code necessary to start processing your job. This method should block until job processing is complete.
Call UpdatePercentage to inform the windows service of the current progress. If the UpdatePercentage Method returns false, this means the job was either aborted or deleted by the user. In this case, you should stop processing and call the SetAbortedStatus Method. For more information, refer to the UpdatePercentage Method.
Upon successful completion of the job processing, call the SetCompletedStatus Method.
If the job fails for any reason call the SetFailureStatus Method.
If your process hangs the windows service will terminate the process. In the case where your process is killed, or unexpectedly terminates, your worker assembly will be reloaded and the OnJobTerminated Method (if implemented) will be called so that you can react accordingly to the error. For more information, refer to OnJobTerminated.
The configuration file allows you to specify the namespace and class of your assembly. This instructs the process what assembly to load when a new job is received. For more information, refer to LEADTOOLS Cloud Settings.