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
8
votes
1 answer

Akka-http streaming using Slick 3.0 Databasepublisher

I am using slick 3.0 and have a databasepublisher object as def getAsStream = db.stream[Entity](tblquery.result) I am using akka-http for rest layer as follows, val route = path("stream"){ get { complete { // how to stream from here } …
S.Karthik
  • 1,389
  • 9
  • 21
7
votes
0 answers

Akka-http detect client connection close

I have a question. I have Akka HTTP Server and using Akka HTTP Client. The Client does a lot of external calls basically with Http.singleRequest(). This takes a lot of time and sometimes User closes the connection to my Server. So the question is…
7
votes
1 answer

Nesting CRUD paths in akka-http directives

I am just starting with Scala and Akka. I am writing a small REST service. I am trying to create following paths: GET localhost:8080/api/my-service (return collection of resources) GET localhost:8080/api/my-service/6 (return resource with specified…
daniyel
  • 652
  • 10
  • 28
7
votes
2 answers

What is the difference between idle-timeout and request timeout in akka http configuration?

I went to the documentation and found out these # The time after which an idle connection will be automatically closed. # Set to infinite to completely disable idle connection timeouts. idle-timeout = 10 s # Defines the default time…
Atiq
  • 396
  • 1
  • 3
  • 10
7
votes
2 answers

String Parameters using Akka HTTP Directives during GET requests

I have defined methods as getJobByID and getJobByName in scala , now I am able to pass the Id parameter during the GET call as val route = (path("dataSource"/LongNumber) & get){ id => complete(getJobById(id).map(_.asJson)) } Now I want to get…
Vishal
  • 1,442
  • 3
  • 29
  • 48
7
votes
1 answer

akka http client system.shutdown() produce "Outgoing request stream error (akka.stream.AbruptTerminationException)" when using https

Hi the following code works as expected. implicit val system = ActorSystem() implicit val materializer = ActorMaterializer() import system.dispatcher val request = HttpRequest(uri =…
Xzer
  • 93
  • 6
7
votes
2 answers

Akka HTTP Websocket, how to identify connections inside of actor

I'm working on simple mulitplayer game in scala that I would like to expose through websockets for JS clients. Here is my WebsocketServer class class WebsocketServer(actorRef: ActorRef, protocol: Protocol, system: ActorSystem, materializer:…
Norbert Orzechowicz
  • 1,329
  • 9
  • 20
7
votes
3 answers

Static resource reload with akka-http

In short: is it possible to reload static resources using akka-http? A bit more: I have Scala project. I'm using App object to launch my Main class. I'm using getFromResourceDirectory to locate my resource folder. What I would like to have is…
psisoyev
  • 2,118
  • 1
  • 25
  • 35
7
votes
1 answer

Akka Flow hangs when making http requests via connection pool

I'm using Akka 2.4.4 and trying to move from Apache HttpAsyncClient (unsuccessfully). Below is simplified version of code that I use in my project. The problem is that it hangs if I send more than 1-3 requests to the flow. So far after 6 hours of…
expert
  • 29,290
  • 30
  • 110
  • 214
7
votes
3 answers

How to properly call a single server from multiple actors / web handlers using Akka HTTP?

I have a service (let's call it Service A) which uses Akka Server HTTP to handle incoming requests. Also I have 3rd party application (Service B) which provides several web services. The purpose of service A is to transform client requests, call…
relgames
  • 1,356
  • 1
  • 16
  • 34
7
votes
3 answers

How to unmarshall `text/plain` as JSON in Akka HTTP

I'm working with a legacy HTTP API (that I can't change) that responds with JSON in the body, but gives a Content-Type: text/plain; charset=utf-8 header. I am attempting to unmarshall that HTTP body as JSON, but I get the following exception:…
David van Geest
  • 1,957
  • 1
  • 20
  • 19
7
votes
1 answer

Is it possible to make an Akka HTTP core client request inside an Actor?

Below is a simple actor which is required to make a HTTP call to receive data from an API. According to the Akka HTTP Core Request-Level Client-Side API only the ActorSystem and ActorMaterializer are needed implicitly. class MyActor extends Actor…
David Caseria
  • 261
  • 2
  • 9
6
votes
1 answer

How to wrap my routes in an authentication directive that then gives visibility to a custom class for my routes to access

My API clients will pass the session token in the header or query string like: Http Header with key/value like MyApp-Token abc123 Url: https://api.example.com/v1/board?authToken=abc123 val secureRoutes = authenticateToken() {…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
6
votes
2 answers

akka http to use Json Support and xmlsupport

I want to print data in xml format when department is "hr"but data in json format when department is "tech" . Can we use spray-json Support https://doc.akka.io/docs/akka-http/current/common/json-support.html and XML support …
coder25
  • 2,363
  • 12
  • 57
  • 104
6
votes
1 answer

Akka Http.get(ActorSystem) leads to Ambiguous method call in intellij

intellij has problems with when a subclass specifies a more specific return type. This is the case for Akka's Http.get(ActorSystem) method. This is issue is reported to JB but they have not responded yet. SCL-12302
Thomas W.
  • 652
  • 1
  • 7
  • 18