nitcorn :: MyAction :: async_service
async_service?str=some_string
This method is executed by the thread_pool
attribute of this class.
Be careful when using the async
argument to follow all the good
concurrent programming pratices.
# Asynchronous method answering requests such as `async_service?str=some_string`
#
# This method is executed by the `thread_pool` attribute of this class.
# Be careful when using the `async` argument to follow all the good
# concurrent programming pratices.
fun async_service(str: String): HttpResponse
is restful(async) do
# "Work" for 2 seconds
2.0.sleep
# Answer
var resp = new HttpResponse(200)
resp.body = "async_service {str}"
return resp
end
lib/nitcorn/examples/src/restful_annot.nit:51,2--66,4