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
9
votes
2 answers

How to use Akka HTTP to generate contents via an output stream

I'm quite newbie to Akka Streams and Akka HTTP. I'd like to generate a simple HTTP server that can generate a zip file from the contents of a folder and send it to the client. The org.zeroturnaround.zip.ZipUtil makes the task of creating a zip file…
david.perez
  • 6,090
  • 4
  • 34
  • 57
9
votes
1 answer

Show list of all routes in Akka HTTP

I have a small Akka Http server. Is there a way of listing all server routes/services?
bashan
  • 3,572
  • 6
  • 41
  • 58
9
votes
3 answers

Listening to Akka-HTTP ports remotely

When binding calls to port 9000 with Akka-HTTP Http().bindAndHandle(routes, "localhost", 9000) It starts listening to the port as seen with 'netstat -tulpn' Proto Recv-Q Send-Q Local Address Foreign Address State tcp6 0 0 …
JasperJ
  • 1,192
  • 1
  • 12
  • 23
9
votes
1 answer

Akka-streams - how to access the materialized value of the stream

I am learning to work with Akka streams, and really loving it, but the materialization part is still somewhat a mystery to me. Quoting from…
Yardena
  • 2,837
  • 20
  • 17
9
votes
3 answers

Close akka-http websocket connection from server

In my scenario, a client sends "goodbye" websocket message and I need to close previously established connection at the server side. From akka-http docs: Closing connections is possible by cancelling the incoming connection Flow from your server…
Tvaroh
  • 6,645
  • 4
  • 51
  • 55
9
votes
4 answers

Akka Http: Exceeded configured max-open-requests value of [32]

I post some data to Server using the following code def post(endpoint: String, entity: Strict) = { Http().singleRequest(HttpRequest(uri = Notifier.notificationUrl + endpoint, method = HttpMethods.POST, entity = entity)) onComplete { …
daydreamer
  • 87,243
  • 191
  • 450
  • 722
9
votes
3 answers

Akka Http Route Test: Request was neither completed nor rejected within 1 second

I am trying to write a test case for my application with akka-http. One of the testcases is given below: import akka.http.scaladsl.model.headers.RawHeader import akka.http.scaladsl.testkit.{ ScalatestRouteTest} import…
Yadu Krishnan
  • 3,492
  • 5
  • 41
  • 80
8
votes
1 answer

WireMock error while trying to mock an HttpClient with Proxy

I have an Http Client which uses a proxy in real life to send a request to an API. I am trying to use WireMock to run my http client tests and mock the responses for the API. However, I could not manage to make Wiremock work with a proxy setup. I…
8
votes
3 answers

SHA256 of data stream

I am having a use case where i am downloading the file from URL using GET request. Is it possible to calculate SHA256 of file stream without saving to disk or holding an entire object in memory?
Rajeev
  • 4,762
  • 8
  • 41
  • 63
8
votes
1 answer

Chain Akka-http-client requests in a Stream

I would like to chain http request using akka-http-client as Stream. Each http request in a chain depends on a success/response of a previous requests and uses it to construct a new request. If a request is not successful, the Stream should return…
Rabzu
  • 52
  • 5
  • 26
8
votes
1 answer

How to include application/x-www-form-urlencoded HttpHeader in Akka-http 2.4.1?

I am using Akka Http 2.4.1 to post a https request to the twitter api. According to their documentation, I need two httpheaders. Namely, Authorization and ContentType. To quote their docs: The request must include a Content-Type header with the…
Rob O'Doherty
  • 549
  • 3
  • 14
8
votes
1 answer

Is it possible to use implicit parameters when defining routing directives?

I have a directive, defined like def allowedRoles(roles: UserRole*)(implicit login: Login): Directive0 = ??? But I don;t seem to be able to use it in without having to explicitly pass in the login parameter def myRoutes(implicit req: HttpRequest,…
Ian Phillips
  • 567
  • 4
  • 13
8
votes
1 answer

Akka HTTP: How to unmarshal Json format response into domain objects

I am trying out Akka HTTP, and I have created a service that returns a Json Array of domain objects in HttpResponse. In the client I want to convert it to a Source of domain objects so it can be consumed by the subsequent Flows and Sinks. Referring…
pumpump
  • 361
  • 2
  • 15
8
votes
2 answers

How to complete a request in another actor when using akka-http

I am using akka-http 1.0 and I would like to use a route defined as def route: Route = path("") { // start actor with requestContext // call requestContext.complete(...) in actor with the result } How do I accomplish this?
John Pertoft
  • 1,045
  • 1
  • 9
  • 17
8
votes
1 answer

How do I mix typed and untyped actors?

How do I mix typed and untyped actors ? As I understood I have to specify main actor when I create instance of ActorSystem like this val system: akka.typed.ActorSystem[Start] = akka.typed.ActorSystem("main", Props(mainBehaviour)) On the other hand…
expert
  • 29,290
  • 30
  • 110
  • 214