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

How to throttle Futures with one-second delay with Akka

I have list of URIs, each of which I want to request with a one-second delay in between. How can I do that? val uris: List[String] = List() // How to make these URIs resolve 1 second apart? val responses: List[Future[Response]] =…
eguneys
  • 6,028
  • 7
  • 31
  • 63
3
votes
1 answer

What is the correct way to register generic type to spray-json-support in akka-http Scala?

So, I have this class: case class Something[T](data: Option[T] = None) And i register it like the instruction said in https://github.com/spray/spray-json and in https://doc.akka.io/docs/akka-http/current/common/json-support.html. Like this: import…
Enki Probo
  • 51
  • 6
3
votes
2 answers

Akka Http Test Gzip Response

So, I have a set of Akka Http routes written in scala. Which looks like this val route: Route = { handleRejections(PrimaryRejectionHandler.handler) { handleExceptions(PrimaryExceptionHandler.handler) { cors() { …
debduttoc
  • 304
  • 2
  • 9
3
votes
0 answers

Akka HTTP, Spray Json and Option Fields Failing as Required

I have a case class: case class OpcTagPlaybook(name: String, tags: Seq[OpcTagAtTime], looped: Boolean, enabled: Option[String]) With an optional enabled field that will contain a date. Spray Json describes encoding/decoding: implicit val…
JasonG
  • 5,794
  • 4
  • 39
  • 67
3
votes
1 answer

AkkaHTTP: Getting content out of an HttpEntity

I'm working with AkkaHTTP in Scala, trying to interact with an API, but I'm having some trouble getting data with certain API calls. Basically, I have a curl command which works in my terminal for any valid API call to this certain API, but in my…
3
votes
1 answer

Stream paginated API response over WebSocket using Akka

On the serverside, I'm consuming an HTTP API that returns its results in pages. As in, the response contains x amount of results and if there were more than 0 I can call it again to get the next x results. x can be arbitrarily chosen up until the…
3
votes
0 answers

Using an actor system in Flink

I have a few libraries for doing IO, with large amounts of data, that use akka-http. Now. I have a Flink application, where I need to use those libraries. How do I use a common actor-system across my flink app? I mean, AFAIU, flink apps will be…
Bhashit Parikh
  • 3,121
  • 23
  • 24
3
votes
1 answer

Complete request with latest item in a flow

I'd like to complete a GET request with the latest available item in a flow. This flow in particular aggregates events produced by an actor and already individually consumed by a WebSocket. Let's say that the event can be represented as…
stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
3
votes
1 answer

Best way to keep WebSocket connection alive in Akka HTTP?

If there is no message sent or received, the connection is closed after one minute. I don't want to continuously send a text message to keep the connection open like this: keepAlive(maxIdle = 10.seconds, () => TextMessage.Strict("Keep-alive…
Qwer Sense
  • 487
  • 1
  • 5
  • 12
3
votes
0 answers

Configure AWS API Gateway Client Certificate with Java TrustStore for validating incoming request

I am using Akka 2.4.x and trying to configure the truststore with Akka Http - so that I can validate incoming request to the server. My Stack is: 1. AWS API Gateway - Sending a Client certificate 2. AKKA HTTP using java truststore for…
3
votes
0 answers

Akka streams Source.actorRef vs Source.queue vs buffer, which one to use?

I am using akka-streams-kafka to created a stream consumer from a kafka topic. Using broadcast to serve events from kafka topic to web socket clients. I have found following three approaches to create a stream Source. Question: My goal is to…
Vms
  • 199
  • 2
  • 11
3
votes
1 answer

Akka HTTP API service with file upload extractRequestContext and case class at a time?

how can I write the Akka HTTP service with file uploading and also case class to accept the input request from the front end? I have two services like val upload1 = path("api" / "upload1") { extractClientIP { ip => …
newbie
  • 456
  • 1
  • 6
  • 17
3
votes
0 answers

Akka HTTP paginated HttpResponse

I am trying to consume a paginated REST call, currently doing something like: def depaginateGetEnvironmentUuids(uri: Uri, filters: Seq[BasicNameValuePair], pageNumber: Int = 1): Future[Seq[UUID]] = { val paginationFilters = Seq(new…
rojanu
  • 1,592
  • 5
  • 20
  • 34
3
votes
1 answer

streaming an archive that is being composed from other streams

Say I have a lot of files in s3 and depending on user request I want starting streaming an archive that is being built from other s3 file streams. Is it possible to implement stream flow like below? What archive does provides asyc composing and…
kraken
  • 484
  • 7
  • 18
3
votes
1 answer

Scala Akka Http - Use routes to return Future [A] as Json

Akka Http version: "com.typesafe.akka" %% "akka-http" % "10.0.11" Stream version: "com.typesafe.akka" %% "akka-stream" % "2.5.7" Play Json version: "com.typesafe.play" %% "play-json" % "2.6.7" I have the following method in the crudService: def…
user5853948