asynchronous - Accessing spray request from spray response -
i'm calling function every 50 ms :
def send() = { val mydata = generaterandomdata() val response = pipeline(post("http://slow-website.com/send", mydata)) response oncomplete { case success(r) => ? how access mydata ? case failure(error) => print(error.getmessage) } }
i know data sent in successfull request.
how can achieve this?
just refer mydata
.
what happens behind scenes scala compiler creates closure oncomplete
handler argument captures reference mydata
can use it.
Comments
Post a Comment