spray

How does spray.routing.HttpService dispatch requests?

自古美人都是妖i 提交于 2019-11-29 08:49:13
Disclaimer: I have no scala experience for now, so my question is connected with very basics. Consider the following example (it may be incomplete): import akka.actor.{ActorSystem, Props} import akka.io.IO import spray.can.Http import akka.pattern.ask import akka.util.Timeout import scala.concurrent.duration._ import akka.actor.Actor import spray.routing._ import spray.http._ object Boot extends App { implicit val system = ActorSystem("my-actor-system") val service = system.actorOf(Props[MyActor], "my") implicit val timeout = Timeout(5.seconds) IO(Http) ? Http.Bind(service, interface =

Is it possible to install a callback after request processing is finished in Spray?

痴心易碎 提交于 2019-11-29 02:42:58
I'm trying to serve large temporary files from Spray. I need to delete those files once HTTP request is complete. I could not find a way to do this so far... I'm using code similar to this or this: respondWithMediaType(`text/csv`) { path("somepath" / CsvObjectIdSegment) { id => CsvExporter.export(id) { // loan pattern to provide temp file for this request file => encodeResponse(Gzip) { getFromFile(file) } } } } So essentially it calls getFromFile which completes the route in a Future . The problem is that even if that Future is complete the web request is not complete yet. I tried to write a

Can Spray.io routes be split into multiple “Controllers”?

梦想与她 提交于 2019-11-28 17:14:01
问题 I haven't found a solid example or structure to splitting up Spray.io routes into multiple files. I am finding that the current structure of my routes are going to become very cumbersome, and it would be nice to abstract them into different "Controllers" for a very simple REST API app. Docs don't seem to help too much: http://spray.io/documentation/spray-routing/key-concepts/directives/#directives Here's what I have so far: class AccountServiceActor extends Actor with AccountService { def

How to deploy my spray API into production?

寵の児 提交于 2019-11-28 16:43:57
I'm thinking about how should be the process to deploy my already locally tested rest api to the cloud, lets say an infrastructure as a service (not a platform as a service such as Heroku) like amazon. I have my local envorinment set up with sbt up and running but my question is How should I deploy this in a production environment? Is it sane to define a process in which the devops pulls the most recent changes from the git repo and then simply executes sbt run? I want to know how does the teams that uses scala+spray+sbt deploys their apis to a production environment. 4lex1v The heart of our

How does spray.routing.HttpService dispatch requests?

久未见 提交于 2019-11-28 02:13:05
问题 Disclaimer: I have no scala experience for now, so my question is connected with very basics. Consider the following example (it may be incomplete): import akka.actor.{ActorSystem, Props} import akka.io.IO import spray.can.Http import akka.pattern.ask import akka.util.Timeout import scala.concurrent.duration._ import akka.actor.Actor import spray.routing._ import spray.http._ object Boot extends App { implicit val system = ActorSystem("my-actor-system") val service = system.actorOf(Props

How to deploy my spray API into production?

醉酒当歌 提交于 2019-11-27 09:52:43
问题 I'm thinking about how should be the process to deploy my already locally tested rest api to the cloud, lets say an infrastructure as a service (not a platform as a service such as Heroku) like amazon. I have my local envorinment set up with sbt up and running but my question is How should I deploy this in a production environment? Is it sane to define a process in which the devops pulls the most recent changes from the git repo and then simply executes sbt run? I want to know how does the