Questions tagged [akka-http]

The purpose of the Akka HTTP layer is to expose Actors to the web via HTTP and to enable them to consume HTTP services as a client. It is not an HTTP framework, it is an Actor-based toolkit for interacting with web services and clients.

The purpose of the Akka HTTP layer is to expose Actors to the web via HTTP and to enable them to consume HTTP services as a client. It is not an HTTP framework, it is an Actor-based toolkit for interacting with web services and clients.

More Info:

1489 questions
4
votes
1 answer

How to clean up akka-http websocket resources following disconnection and then retry?

The code below successfully establishes a websocket connection. The websockets server (also akk-http) deliberately closes the connection using Andrew's suggested answer here. The SinkActor below receives a message of type akka.actor.Status.Failure…
Rob O'Doherty
  • 549
  • 3
  • 14
4
votes
2 answers

Akka HTTP and long running requests

We have an API implemented in bare bones Scala Akka HTTP - a couple of routes fronting for a heavy computation (CPU and memory intensive). No clustering - all running on one beefy machine. The computation is proper heavy - can take more than 60s to…
Anton
  • 3,006
  • 3
  • 26
  • 37
4
votes
2 answers

akka http, charset header, utf-8 issue

I have this route: path("rus") { complete("Привет!") } When i go /rus with browser (chrome) i get this output: "Привет!" Why? Response headers are: HTTP/1.1 200 OK Server: akka-http/2.4.10 Date: Mon, 10 Oct 2016 22:31:53 GMT Content-Type:…
Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64
4
votes
1 answer

What is causing the delay after converting HttpEntity to String via toStrict()

I'm using akka-http for a web application that has a quite short response time target. I use the routing DSLs completeWithFuture method with a chain of CompletableFutures. I noticed that, when chaining every future using the XXXasync variant of the…
teano
  • 505
  • 5
  • 12
4
votes
3 answers

Akka-Http 2.4.9 throws java.lang.NoClassDefFoundError: akka/actor/ActorRefFactory exception

I am trying to build a simple web service with Akka-http. I followed this guide: http://doc.akka.io/docs/akka/2.4.9/scala/http/low-level-server-side-api.html and everything works fine, when I run sbt run. When I execute java -jar PROJECT.jar it…
Steffen Schmitz
  • 860
  • 3
  • 16
  • 34
4
votes
3 answers

Akka-http: How to get User-Agent header from request header?

I was trying to extract User-agent header from Request-Header, I tried this : headerValue(extractUserAgent) { userAgent => } def extractUserAgent: HttpHeader => Option[String] = { case h: `User-Agent` => Some(h.) case x => None …
Aamir
  • 2,380
  • 3
  • 24
  • 54
4
votes
6 answers

Scala future with akka-http

I need to write simple web service with akka-http and reactivemongo. Function to save data looks like this def saveRoute(route: Route):Future[WriteResult] = { collection.insert(route) } a code that calls this function looks like this val…
green-creeper
  • 316
  • 3
  • 15
4
votes
1 answer

Akka Http return 404 Not Found

I'm trying to achieve very simple thing. Say, I have a REST API. When I call /api/recipe/1 I'd like to a resource as a json to be returned. When I hit /api/recipe/2 a 404 Not Found HTTP response should be returned. Simple as that. Clearly I'm…
David Siro
  • 1,826
  • 14
  • 33
4
votes
1 answer

trait with only case objects custom implementation in spray json

Given I have the following declaration: sealed trait Color case object DColor extends Color case object CColor extends Color case object VColor extends Color And then I use them In a case class like so: case class CustomColor(c:…
user3139545
  • 6,882
  • 13
  • 44
  • 87
4
votes
2 answers

Akka http using java - get String from RequestEntity

I'm trying to get the body of an http request, but it seems like it's not as simple as it might sound, unless of course I'm missing something. I have an instance of the HttpRequest (from akka.http.javadsl.model) and from that I can get the…
Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
4
votes
2 answers

How to provide a custom Deserializer for akka-http query parameters?

The akka-http 2.4.7 reference states that it's possible to do custom Deserializers to convert query parameters, without storing them in an intermediate variable: "amount".as[Int] extract value of parameter "amount" as Int, you need a matching…
akauppi
  • 17,018
  • 15
  • 95
  • 120
4
votes
0 answers

Akka Http Websocket Test using Mocking

I am quite new to akka-http and especially to websockets. I have a service which runs on localhost:8080 and has a path /greeter. When a request comes on this path then it forwards the request to /greeter on localhost:9000 where the handler is of…
4
votes
1 answer

How to use .withoutSizeLimit in Akka-http (client) HttpRequest?

I'm using Akka 2.4.7 to read a web resource that is essentially a stream of JSON objects, delimited with newlines. The stream is practically unlimited in size. When around 8MB has been consumed, I get an exception: [error] (run-main-0)…
akauppi
  • 17,018
  • 15
  • 95
  • 120
4
votes
2 answers

Akka-Http: How to TestProbe a request

I have a request whose response depends on an actor reply. I am trying to test it in this way: val myActor:TestProbe = TestProbe() val route = new MyRoute() { override def myServiceActor:ActorRef = { myActor.ref } }.route "return a…
Randomize
  • 8,651
  • 18
  • 78
  • 133
4
votes
1 answer

Non blocking operation In Flink or Sparks vs Akka stream

I am learning and evaluating sparks and Flink before picking one of them for a project that I got. In my evaluation I came up with the following simple tasks, that I can figure out how to implement it in both framework. Let say that 1-/ I have a…
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127