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

How to access REST API on a unix domain socket with Akka HTTP or Alpakka?

I would like to access the docker API using the /var/lib/docker.sock unix domain socket. I've seen examples where you can use (modern versions of) curl to call the API as follows: curl --unix-socket /var/run/docker.sock http:/containers/json where…
4
votes
1 answer

Handle SIGTERM in akka-http

The current (10.1.3) Akka HTTP docs: https://doc.akka.io/docs/akka-http/current/server-side/graceful-termination.html talk about graceful termination, using this code sample: import akka.actor.ActorSystem import…
Rory
  • 798
  • 2
  • 12
  • 37
4
votes
2 answers

Connecting Akka HTTP directly to an Akka Stream Flow

I've looked through the examples at https://doc.akka.io/docs/akka-http/current/introduction.html for Akka HTTP routing and strangely for something built on top of Akka Streams none of the examples connect to a stream. Can somebody show a simple…
David Plumpton
  • 1,929
  • 23
  • 31
4
votes
2 answers

How does one measure throughput of Akka WebSocket stream?

I am new to Akka and developed a sample Akka WebSocket server that streams a file's contents to clients using BroadcastHub (based on a sample from the Akka docs). How can I measure the throughput (messages/second), assuming the clients are consuming…
Vms
  • 199
  • 2
  • 11
4
votes
0 answers

Avoiding Akka HTTP IO-TCP registration failures

I occasionally receive the following messages when starting my app. When I do, the app fails to initialise. Unhandled: DeadLetter( Register(Actor[akka://myapp/user/StreamSupervisor-0/$$7#141722842],true,false), …
Synesso
  • 37,610
  • 35
  • 136
  • 207
4
votes
3 answers

How to send a file as a response using akka http?

I am a little new to akka world, so my domain of knowledge is a bit small. I am creating an https server and handling it using akka streams and http, for a specific url, i need to send a file back to client. How can i achieve that using akka streams…
Saksham
  • 127
  • 3
  • 9
4
votes
3 answers

How to stop Spray server with routing DSL without upgrading to Akka HTTP?

I have this route: val route = pathPrefix("es") { path("se") { post { entity(as[JsValue]) { t => complete("ok") } } } ~ path("q" / "show") { get { complete(q) } } } When I try to bind it in…
Jas
  • 14,493
  • 27
  • 97
  • 148
4
votes
4 answers

Play Framework test helpers need implicit `Materializer`

I'm using Play 2.6.x and the test helper for status(result) has the method: def status(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Int = status(of.run()) Running tests throws when the compiler can't find the…
tgk
  • 3,857
  • 2
  • 27
  • 42
4
votes
1 answer

How to Enable Source.Queue Backpressure

I'm using host-level API with a queue. private val (queueSource, connectionPool) = Source.queue[(HttpRequest, Promise[HttpResponse])](queueSize, OverflowStrategy.backpressure).async .viaMat(poolFlow)(Keep.both) .toMat( …
Rabzu
  • 52
  • 5
  • 26
4
votes
2 answers

How to match, but not consume, a path prefix in Akka HTTP?

my Akka HTTP application reverse-proxies some requests to an internal HTTP system: pathPrefix("/api/") { (path("some-upload-endpoint") & post) { withSizeLimit(10 * 1024 * 1024) { reverseProxyToBackend(rc) } } ~…
user355252
4
votes
1 answer

Akka stream stays idle instead of throwing exception

I am new to Akka/Scala and am trying to debug the code below. When the resultSetParser has an exception, it does not throw it. Instead the service that uses this code just sits idle forever. How can I make my service throw the exception rather than…
Darth.Vader
  • 5,079
  • 7
  • 50
  • 90
4
votes
1 answer

How to mock or stub AWS SDK S3 bucket calls in Scala or Java?

I've created an application using the Akka HTTP framework and Scala, that sends files to my S3 bucket using the SDK. I'm trying to write unit and integration tests for the code and I am unsure about how to mock or stub these external calls, as it…
ChazMcDingle
  • 635
  • 2
  • 10
  • 18
4
votes
0 answers

How to do akka-http request-level backpressure?

In akka-http, you can: Set akka.http.server.max-connections, which will prevent more than that number of connections. Exceeding this limit means clients will get connection timeouts. Set akka.http.server.pipelining-limit, which prevents a given…
4
votes
2 answers

Why does Source.tick stop after one hundred HttpRequests?

Using akka stream and akka HTTP, I have created a stream which polls an API every 3 seconds, Unmarshalls the result to a JsValue object and sends this result to an actor. As can be seen in the following code: // Source which performs an http request…
DP Greveling
  • 409
  • 5
  • 12
4
votes
1 answer

Akka http redirect but change method from POST to GET

I have endpoint using POST method ( registering token for example ), after job done I want to redirect client to "/" url, but using GET not POST. How to achieve this ? For now I have: redirect("/", StatusCodes.PermanentRedirect)
FrancMo
  • 2,459
  • 2
  • 19
  • 39