Continue Async Task after return statement too.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Continue Async Task after return statement too.

 I have a Rest API, where I have called an aws service and save the records on a single endpoint at the same time. In order to respond quickly, I want to run the aws service asynchronously, even after the API responds too in grails. Please suggest how could I achieve it?

I have included a prototype of the  async task implemented in a service  as :

def method1(){

        task {
       // time consuming service call.
   }.onError{ Throwable error ->
         println ":::::: Error :::::"+error.getMessage()
return ["msg":"success"]

I want to return the success message on the complete execution of saverecords() function and continue the task (process) in the background. But i have got an error on the completion of task thread execution.

You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit
For more options, visit