Asynchronous process
When there is a lot of data to process some services don’t return the results directly but start an asynchronous process (or thread). The thread writes results to a log which can be accessed at another time.
When a service starts a thread it returns a HTTP code 202
Accepted instead of 200
OK.
XML returned
When a thread is started, the service output includes the following thread XML:
<thread id="[thread id]" name="[thread name]" username="[username of user starting thread]" groupid="[ID of group if applicable or -1]" status="[initialised| inprogress| error| warning| cancelled| failed| complete]"> [<message>[explanation or error]</message>] [thread specific XML] </thread>
For example:
<thread id="349f4fbcd872d514751f7809acf4d888" name="Moving thread for group test-local5" username="jjones" groupid="240" status="initialised"> <message>Finding URIs</message> </thread>
The statuses error
and warning
are only transitory states, and the thread will always terminate only with one of completed
, failed
, or cancelled
which are final states. This is because there may be several errors or warnings. Threads that include warnings would usually result in a completed
state and errors in a failed
state.
Thread services
Various services can be used to:
- list current threads.
- check a thread’s progress.
- get a thread's logs.
- cancel a thread.
See the Thread category under Services for more details.
Services that have a group in their URL are generally used by group contributors or managers while the others are used by system administrators.