Wednesday, 20 September 2017
Async-Rest API
How to handle a long job in a Rest API? A task may take a long time to compute and therefore resource may not be ready at once.
In such case, rest controller may feedback request by an HTTP status, i.e. accepted and a task token, meanwhile, it spawns a thread to carry out this long job. Once the job is done, the result will be put a queue or a database, where it waits for the user to fetch it.
A client may use task token to check the job status, (in processing, or completed); Once it is completed, the client may use the token to query the result back.
References:
https://farazdagi.com/2014/rest-and-long-running-jobs/
http://www.nurkiewicz.com/2013/03/deferredresult-asynchronous-processing.html
Subscribe to:
Post Comments (Atom)
Can Jackson Deserialize Java Time ZonedDateTime
Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...
-
Could not extract response: no suitable HttpMessageConverter found for response type [class dk.enettet.evu.core.model.Address] and content ...
-
First time met this hibernate exception. I think this issue should due to one to one relationship. One driver has one car; one car has on...
-
A large object refers to the entity property that is modified by @Lob. It may be persisted in several records. However, in database manage...
No comments:
Post a Comment