Zaqar/specs/use-cases/5

= Marconi: Use Case 5 =

Request information from an agent.

Main Sequence
1. Requester generates and signs request, then submits it to Service.

2. Service acknowledges message and guarantees its durability, also returning the ID generated for the message.

3. Agent retrieves request from Service.

4. Agent verifies request.

5. Agent processes request.

6. Agent prepares a response that includes a reference to the original request ID, then signs the message and submits it to Service.

7. Requester retrieves Agent response from Service.

8. Requester verifies Agent response.

9. Requester matches Agent response to original request by checking the attached ID.

10. Requester processes response.

11. Agent loops to (3)

Variations
2a. Service is unable to persist request in a durable manner: Service returns error status and information to Requester; Requester may choose to retry the request or simply note the failure and carry on, depending on the nature of the error received.

3a. More than one request has been enqueued: Agent retrieves up to min(50, n), where n is specified by the Agent in each request to Service.

3b. No requests are available: Service returns "no content" status code, and Agent must try again after some delay.

4a. Request's signature is invalid: Agent ignores the bad request by skipping the next several steps (5-10).

8a. Agent response is invalid: Requester notes the problem and skips subsequent steps (9-10).

9a. ID cannot be matched: Proceed as in (8a).

11a. More than min(50, n) messages are enqueued, or Requester submits requests faster than they can be consumed: Agents loop until all requests have been processed. Requester may need to increase TTL for requests so that Agents are able to keep up.