java - How to handle Asynchronous operations in REST -


i need understand approaches pros-n-cons handle asynchronous operations in rest. approaches found:

1- resource based: status of operation modeled status. user makes asyn rest call (put, post etc) gets accepted or in-progress response (202). further status uri polled repeatedly via check status/progress/messages operation execution.

question: how long resource active @ server? if client polls in large intervals in between operation completes, how return status? seems persisting execution status work. how long persist, when archive/delete, kind of standard approach?

2- callback based: async request required have callbackuri, request gets processed asynchronously , upon completion makes call callbackuri operation status/result.

question: seems more elegant, less overhead @ server-side. scenarios callback server intermittently down not responding etc, how handle this? implement typical retries callbackuri provides retries configuration well? there other downside approach?

3- servlet 3.0 asynchronous support: http client java servlet makes connections, remains open until explicitly closed, until closed client-server can communicate asynchronously on it.

question: since servlet 3.0 spec, think jersey, spring rest implementation doesn't utilizes approach of now. there specific rest implementation utilizes similar approach or pointer on ways make possible?

4- other approaches may commercial ones?

spring 3.2+ supports async features of servlet 3.0. spring blog:

you can make existing controller method asynchronous changing return callable. example controller method returns view name, can return callable instead. @responsebody returns object called person can return callable instead. , same true other controller return value type.

jersey 2+ supports asyncronous servers. see asynchronous services , clients chapter in reference docs.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -