title: How to handle asynchronous operations in REST
body: <p>I need to understand what approaches there are to handle asynchronous operations in REST and what their advantages and disadvantages are. Some approaches I found:</p>
  
  <ol>
  <li><p><strong>Resource Based:</strong> Where the status of an operation is modeled as a status. User makes an async REST call (PUT, POST etc.) gets <code>Accepted</code> or <code>In-Progress</code> response (<code>202</code>). Further a status URI is polled repeatedly via GET to check status/progress/messages from operation execution.</p>
  
  <p><strong>Question:</strong> How long should this resource be active at Server? If the client polls in large intervals where in between the operation completes, how do we return the status? Seems like persisting the execution status would work. But how long to persist, when to archive/delete, is this kind of standard approach? </p></li>
  <li><p><strong>Callback Based:</strong> Where an async request is required to have a callback URI. The request gets processed asynchronously and upon completion makes a call to the callback URI with the operation status/result.</p>
  
  <p><strong>Question:</strong> This seems more elegant and involving less overhead at the server side. But how to handle scenarios where the callback server is intermittently down, not responding, etc.? Implement a typical retries where the callback URI provides retries configuration as well? Is there any other downside to this approach?</p></li>
  <li><p><strong>Servlet 3.0 Asynchronous support:</strong> Where an HTTP client makes a connection to a Java Servlet, which remains open until it is explicitly closed and until closed client and server can communicate asynchronously over it. </p>
  
  <p><strong>Question:</strong> Since its Servlet 3.0 spec, I think Jersey, the Spring REST implementation, doesn't utilize this approach as of now. Is there any specific REST implementation which utilizes a similar approach or pointer on ways to make it possible?</p></li>
  <li><p>Any other approaches, maybe commercial ones?</p></li>
  </ol>