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
62
votes
3 answers

How to create a Source that can receive elements later via a method call?

I would like to create a Source and later push elements on it, like in: val src = ... // create the Source here // and then, do something like this pushElement(x1, src) pushElement(x2, src) What is the recommended way to do this? Thanks!
ale64bit
  • 6,232
  • 3
  • 24
  • 44
39
votes
5 answers

Spray, Akka-http and Play, Which is the best bet for a new HTTP/REST project

I'm going to develop new HTTP/REST services using Scala and Akka Actors. I have experience working with Play, but I don't really need a complete web Framework. From what I read, I think Spray is a suitable choice. My question come from the future…
Fede
  • 804
  • 1
  • 10
  • 21
38
votes
2 answers

Akka HTTP: Blocking in a future blocks the server

I am trying to use Akka HTTP to basic authenticate my request. It so happens that I have an external resource to authenticate through, so I have to make a rest call to this resource. This takes some time, and while it's processing, it seems the rest…
Kao
  • 2,242
  • 3
  • 22
  • 31
37
votes
7 answers

akka HttpResponse read body as String scala

So I have a function with this signature (akka.http.model.HttpResponse): def apply(query: Seq[(String, String)], accept: String): HttpResponse I simply get a value in a test like: val resp = TagAPI(Seq.empty[(String, String)], api.acceptHeader) I…
tg44
  • 810
  • 1
  • 8
  • 21
35
votes
4 answers

How does one log Akka HTTP client requests

I need to log akka http client requests as well as their responses. While there seems to be a hint of API for logging these requests, there is no clear documentation on how it should be done. My approach has been to create a logged request which…
David Weber
  • 1,965
  • 1
  • 22
  • 32
22
votes
2 answers

Akka Http Performance tuning

I am performing Load testing on Akka-http framework(version: 10.0), I am using wrk tool. wrk command: wrk -t6 -c10000 -d 60s --timeout 10s --latency http://localhost:8080/hello first run without any blocking call, object WebServer { implicit val…
Vikas Naidu
  • 320
  • 2
  • 8
22
votes
2 answers

akka http: Akka streams vs actors to build a rest service

When it comes to creating a REST web service with 60+ API on akka http. How can I choose whether I should go with akka streams or akka actors? In his post, Jos shows two ways to create an API on akka http but he doesn't show when I should select one…
Mutaz
  • 547
  • 4
  • 12
19
votes
2 answers

Differences between Akka HTTP and Netty

Can someone please explain the major differences between Akka HTTP and Netty? Netty offers other protocols like FTP as well. Akka HTTP can be used in Scala and Java and is build on the actor model. But apart from this both are asynchronous. When…
Kris
  • 4,595
  • 7
  • 32
  • 50
19
votes
1 answer

What is the best way to perform OAuth2 authentication using akka-http?

Akka HTTP and Spray provide an authenticateOAuth2 directive, but their documentation states that This directive does not implement the complete OAuth2 protocol, but instead enables implementing it, by extracting the needed token from the HTTP…
Dan Li
  • 866
  • 1
  • 7
  • 19
19
votes
2 answers

Query parameters for GET requests using Akka HTTP (formally known as Spray)

One of the features of Akka HTTP (formally known as Spray) is its ability to automagically marshal and unmarshal data back and forth from json into case classes, etc. I've had success at getting this to work well. At the moment, I am trying to make…
Douglas
  • 2,555
  • 3
  • 24
  • 30
17
votes
3 answers

Akka-http: Accept and Content-type handling

I'm trying out Akka-http and hopefully someone can shed light on a the following questions: How does one create different routes based on the accept: header in the request? For example, i want one code path to handle "json" and one to handle "xml"…
Will I Am
  • 2,614
  • 3
  • 35
  • 61
16
votes
3 answers

Correct use of Akka http client connection pools

I need to consume a REST service using Akka's HTTP client (v2.0.2). The logical approach is to do this via a host connection pool because we expect large numbers of simultaneous connections. The Flow for this consumes a (HttpRequest, T) and returns…
David Weber
  • 1,965
  • 1
  • 22
  • 32
16
votes
3 answers

How to test client-side Akka HTTP

I've just started testing out the Akka HTTP Request-Level Client-Side API (Future-Based). One thing I've been struggling to figure out is how to write a unit test for this. Is there a way to mock the response and have the future completed without…
steinybot
  • 5,491
  • 6
  • 37
  • 55
15
votes
2 answers

Transforming Slick Streaming data and sending Chunked Response using Akka Http

The aim is to stream data from a database, perform some computation on this chunk of data(this computation returns a Future of some case class) and send this data as chunked response to the user. Currently I am able to stream data and send the…
user3294786
  • 177
  • 2
  • 10
15
votes
1 answer

How to properly call Akka HTTP client for multiple (10k - 100k) requests?

I'm trying to write a tool for batch data upload using Akka HTTP 2.0-M2. But I'm facing akka.stream.OverflowStrategy$Fail$BufferOverflowException: Exceeded configured max-open-requests value of [32] error. I tried to isolate a problem and here is…
relgames
  • 1,356
  • 1
  • 16
  • 34
1
2 3
99 100