wiki:FactoryManual/FromScratch

Factory Manual: Building a factory from scratch

<< Previous: Creating new backends

If you cannot build on the existing Python factory implementation then you can also interface directly with the XML-RPC API of Officeshots.org.

The most up-to-date version of the XML-RPC API documentation can be found by browsing to the XML-RPC end-point itself. Officeshots.org distinguishes between browsers and XML-RPC clients. If you visit the XML-RPC endpoint http://dev.officeshots.org/xmlrpc using your browser then you will be shown the most up-to-date documentation generated directly from the PHP source code.

Before you can use the API you need to have an account on the server and an SSL certificate to match. See Setting up your account. You will also need an XML-RPC client that can authenticate using SSL client certificates. The API itself is straight forward. Simply call jobs.poll() to get jobs from the server and call jobs.finish() to upload the processed results. There is currently no need to report errors back to the server. The job will simply time out after a few minutes and handed to a different factory by the central server.

jobs.poll()

You start using the API by calling jobs.poll. The first time you call this function will activate your factory on the server. That means that the applications associated with your factory will be shown on the front page of the Officeshots website. By default, only factories that have been active (i.e. called the jobs.poll function) will be shown on the front page. If there are jobs waiting on the server for your factory then one will be returned.

When a job is returned to you it will be locked for five minutes. That means the job will not be sent to any other factory that could handle the job. This lock expires automatically. If you take longer than five minutes to process the job then it is possible that it has been sent to a different factory. In that case your upload using jobs.finish will fail.

See: XMLRPC/JobsPoll

jobs.finish()

When you have converted the document that you received from the jobs.poll call then you need to upload it using jobs.finish. When the result has been saved you will get back the unique ID for the result (an UUID).

See: XMLRPC/JobsFinish

<< Previous: Creating new backends

Last modified 8 years ago Last modified on 06/30/09 13:54:06