10 Long-running operations

 

This chapter covers...

  • TODO!

In most cases, incoming requests can be processed quickly, generating a response within a few hundred milliseconds after the request is received. In the cases where responses may take significantly longer, the default behavior of using the same API structure and asking users to "just wait longer" is not a very elegant option. In this chapter, we'll explore how to use long-running operations as a way of allowing API methods to behave in an asynchronous manner and ensuring that the slower API methods (including standard methods we saw in Chapter 8) can provide quick and consistent feedback while executing the actual work in the background.

10.1       Motivation

So far, all of the API methods we've explored have always been immediate and synchronous. The service receives a request, does some work right away, and sends back a response. And this particular manner of behavior is actually hard-coded into the API design as the return type is the result, not some promise to return a result later on down the line.

10.2       Overview

10.3       Implementation

10.3.1   What does a long-running operation look like?

10.3.2   Resource hierarchy

10.3.3   Resolution

10.3.4   Error handling

10.3.5   Monitoring progress

10.3.6   Cancelling operations

10.3.7   Pausing and resuming operations

10.3.8   Exploring operations

10.3.9   Persistence

10.3.10   Final API definition

10.4       Trade-offs

10.5       Exercises

10.6       Summary

sitemap