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

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -