Asynchronous request processing

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-11

When an API request is received, Analyzer detail view CRUD interface submits it to the request scheduler and the request is available in the queue. The request is selected by the request processor for processing. The request processor waits for a certain time frame (specified in x-waitTime) to complete the processing. If the processing is not completed in the specified time frame, then the request processor returns the status code and request ID to the client (the client used to invoke the REST API calls) indicating that the request is accepted as the asynchronous job and is being processed. In this case, the client should periodically check the status using the request ID provided in the response.

This approach provides the solution to two issues that generally arise with synchronous processing:
  • Timeout With synchronous processing, the API server waits for an operation to complete before sending any response back to the client. If the connection drops due to network connectivity issues, API server timeout, or client restart, then the client cannot get back the response to its request. By sending the immediate response with the request ID, the API server ensures that the client can track requests in future irrespective of the health and status of the current connection.
  • Incremental results Asynchronous processing enables the client to seek the incremental response from the API server when it is available.

A time frame for which the API request processor waits before sending the Job Accepted response can be configured in request by setting the x-waitTime header. The value for wait the time frame should be in seconds, and the value 0 makes the request processor return a response immediately. If the x-waitTime is not specified or has a negative value, then the default wait time frame of 10 seconds is used.

POST action=retrieveDataset&dataset=defaultDs HTTP /1.1
Authorization:Basic ZnJlZDpmcmVk
x-waitTime:15
The API server waits for request completion or 15 seconds, whichever occurs earlier, before sending the response.

Use case 1: Request completes in x-waitTime

The following diagram shows the asynchronous request processing workflow.

  1. The client sends Request r1 to the API server.
  2. The API server schedules the request and waits for x-waitTime before sending the response to the client.
  3. If the request completes within x-waitTime, then the API server sends complete response to the client.

Use case 2: Request is not completed in x-waitTime; client comes back for response

The following diagram shows the asynchronous request processing workflow, when the request is not completed in the x-waitTime.

  1. The client sends Request r1 to the API server.
  2. The API server schedules the request and waits for x-waitTime before sending a response to the client.
  3. If request is not completed within x-waitTime, then the API server sends a 206 (REQUEST IN PROGRESS) response code along with the request ID to the client.
  4. The client uses the request ID to poll the API server for status of the request.
  5. If request is still being processed, then the API server sends the REQUEST IN PROGRESS response.
  6. If request is completed, then the API server sends the complete response to client along with the request complete response code.
  7. For a request in progress, client periodically polls the API server for status until it gets a request completed response.

Use case 2: Asynchronous query request processing flow

The following diagram shows the asynchronous query request processing workflow.

  1. The client sends Query Request q1 at time (t1) to the API server.
  2. The API server schedules the request and responds on two events, whichever occurs first:
    • Any result is available The server responds with either response code 206 with partial results or response code 200 with complete results.
    • x-waitTime elapses The server responds with response code 206 without any result.
  3. If the API server responds with response code 206, then the client has to poll the server for more query results using getStatus API until it gets complete results.