LEAD Technologies, Inc

Creating Cloud Worker Assemblies

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:

  1. Create an assembly that derives from the JobBase class.

  2. Override the OnJobReceived Method to include any code necessary to start processing your job. This method should block until job processing is complete.

  3. 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.

  4. Upon successful completion of the job processing, call the SetCompletedStatus Method.

  5. 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.

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.