Best practices for worker job item

  • Start the processing in the Run method.

  • Make sure that the worker job item does not create exceptions in the Run method, as it is considered start error.

  • The GetResult method have to contain the following items:

    • Exception code, if there is an exception in the Run method

    • Start error code

    • Runtime errors

    • Description of runtime errors

    • Name of the output xml file

  • It is not necessary to include all processes in the Run method, other threads can be used.

  • Done event has to be launched at the end of the process. It can be anywhere, even in the Run method.

  • Worker job items have to send Progress events within a proper time window. If the time between two events in greater than the value set in OCRService.ini file, the OCRServer terminates the worker job item.

    If the maximum time between Progress events cannot be guaranteed, the worker job item can launch a NewObject event. In this case the OCRServer recalculates the Timeout parameter. NewObject Event should be used sparingly, as it can cause extreme growth of the Timeout parameter.

  • The Ping method have to return as soon as possible.

  • If the KickIdle parameter is True in Ping method, and the worker job item has a result, the worker job item has to launch the Done event, even if the Done event had been launched previously.

  • The worker job item should be able to generate an Output XML file. The structure of the Output XML file is not restricted, but it is suggested to follow the structure of the Output XML files generated by the built-in items.

Before debugging, increase the value of Timeout and RPCTimeOut paramteres to a value few hundred times greater than the original in the OCRService.ini file. It can prevent the termination of OCRServer by the OCRService.

  1. Select Project properties > Debug > Start external program in Visual studio.
  2. Select the OCRServer.exe.
  3. Start debugging.
  4. Start the Workflox XML Designer with the same rights as you started the Visual Studio.
  5. Create a job that uses the worker job item.
  6. Select Job > Run.