Wednesday, 15 May 2013

Spring Rest API - multiple threads -


I have developed a Spring Breast API that takes multipart file in the request and then uploading it to the AWS S3 location is. This process is taking time and the customer will have to wait to complete this whole process.

I do not want the client to wait for the upload process to complete, but I respond to the image URL.

Can I send image URLs in response and open a second thread to upload images to S3?

You can achieve it through the springs, which can take advantage of the 'Service Acct 3.0 Assen capabilities' is.'

Your administrator will see something like this below ( Posted by Basically )

@RequestMapping ("/ upload") @ ResponseBody public Deford Result & lt; String & gt; Upload () {Ultimate Defied Result & lt; String & gt; Suspended result = New deleted result & lt; & Gt; (); RunInOtherThread (deferredResult); Return deferred result; } Private Zero Run inoththread (different result & lt; string & gt; blocked resollement) {// upload AWS S3 for calls and collect adjacent response rtsult.setResult ("File uploaded"); }

See the tutorial for full work example.


No comments:

Post a Comment