Last active
August 29, 2015 14:17
-
-
Save juanpavergara/5f3ef73b9caabb1e48eb to your computer and use it in GitHub Desktop.
Función que recibe un futuro parametrizado y cuando finaliza con éxito hace un callback http a la url indicada con spray-client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ejecutarCallBack[T](fut: Future[T], callback:String): Unit = { | |
fut onComplete { | |
case Success(x) => { | |
println(s"Haciendo callback a: $callback con body ${x.toString}") | |
val pipeline: HttpRequest => Future[HttpResponse] = sendReceive | |
val response: Future[HttpResponse] = pipeline(Post(callback, x.toString())) | |
} | |
case Failure(t) => println(s"Hubo una falla ${t.getMessage}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment