akka-http

Why Akka-Http still uses older Akka-Actor?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 15:36:22
问题 I have added the latest akka-http to my project but that includes the very old 2.4.19 version on akka-actor. Hence I also added akka-actor version 2.5.4 to the dependency. However, that results into following error:- Detected java.lang.NoSuchMethodError error, which MAY be caused by incompatible Akka versions on the classpath. My maven config is like below:- <dependencies> <dependency> <groupId>com.typesafe.akka</groupId> <artifactId>akka-http_2.11</artifactId> <version>10.0.9</version> <

How to aggregate akka-http routes using a trait?

回眸只為那壹抹淺笑 提交于 2019-12-12 16:48:26
问题 I am trying to aggregate routes using a trait at runtime, so far I have object SMController { def aggregateRoutes(actorSystem: ActorSystem): List[Route] = { val runtimeMirror = universe.runtimeMirror(getClass.getClassLoader) val reflections = new Reflections("com.example.api") val subclasses = reflections.getSubTypesOf(classOf[Routable]) val routesList = new ListBuffer[Route]() for (i <- subclasses) { val module = runtimeMirror.staticModule(i.getName) val obj = runtimeMirror.reflectModule

akka-http : could not find implicit value for parameter unmarshalling

房东的猫 提交于 2019-12-12 15:25:57
问题 My spray json support looks like this object MarshallingSupport extends SprayJsonSupport { implicit def json4sFormats: Formats = DefaultFormats } And in my route I want to map the request to a dto object Main extends App with AppConfig with BaseService with MainActorSystem { val processor = system.actorOf(Props(), "processorActor") val view = system.actorOf(Props(), "processorActor") override protected implicit val executor: ExecutionContext = system.dispatcher override protected val log:

How to represent a form-data request using Akka HTTP?

一曲冷凌霜 提交于 2019-12-11 15:49:52
问题 I want to create a form-data http request to Facebook API using Akka HTTP. In curl, the request example looks like: curl \ -X POST \ "https://graph-video.facebook.com/v2.3/1533641336884006/videos" \ -F "access_token=XXXXXXX" \ -F "upload_phase=transfer" \ -F "start_offset=0" \ -F "upload_session_id=1564747013773438" \ -F "video_file_chunk=@chunk1.mp4" So I created a following model for a request payload representation: case class FBSingleChunkUpload(accessToken: String, sessionId: String,

Why does this akka-http route test never complete successfully?

血红的双手。 提交于 2019-12-11 14:46:27
问题 I've a simple route and some tests that success individually, but collectively fail with timeout. Any idea why? val route = (requestHandler: ActorRef @@ Web) => { get { pathPrefix("apps") { pathEndOrSingleSlash { completeWith(implicitly[ToEntityMarshaller[List[String]]]) { callback => requestHandler ! GetAppsRequest(callback) } } ~ path("stats") { completeWith(implicitly[ToEntityMarshaller[List[Stats]]]) { callback => requestHandler ! GetStatsRequest(callback) } } } ~ path("apps" / Segment /

How can I programmatically execute Route of rejection handler and get resulting HttpEntity?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 11:58:50
问题 How can I programmatically execute Route of rejection handler and get resulting HttpEntity ? For example assuming that I have RequestContext object and Rejection object I'd like to execute RejectionHandler.default on it and get HttpEntity . Here is example of what I'd like to do: implicit def myRejectionHandler = RejectionHandler.newBuilder() .handleAll[Rejection] { rejections ⇒ def prefixEntity(entity: ResponseEntity): ResponseEntity = entity match { case HttpEntity.Strict(contentType, data)

How to make akka-http logRequest log to a specific logger log file

安稳与你 提交于 2019-12-11 09:34:39
问题 I have a Main non-actor class where routes are defined. I would like to log the incoming requests to those routes into a specific log file but they are being logged into the "root" log file. val logger = LoggerFactory.getLogger("access_log")l logger.info("log to access log") //<--- is logged in access log file val routes = path("ping" ) { logRequest("logging ping", Logging.InfoLevel) { <-- logged to root log complete("pong") } } } The documentation states that "To change the logger, wrap this

Cannot configure the Akka Http server when using the akka-http-spring-boot library

假如想象 提交于 2019-12-11 09:02:46
问题 I am trying to setup a project that runs REST services on top of a AKKA HTTP server yet managed by Spring boot. Now i found this project on gihub as a reference and am using that as libraries to achieve my goal. This is the project : https://github.com/scalaspring/akka-http-spring-boot Now i cannot figure out a way to override the actor settings like adding a new dispatcher etc . I also cannot override the default port number to intercept the requests. I intend to handle the blocking requests

How extend behaviour of super actor in akka

我是研究僧i 提交于 2019-12-11 07:17:00
问题 I want to implement CRUD operation using akka actor. I am a new in akka so dont know the designing fundamentals of akka actors. I want to share the behaviours of akka actors in multiple sub actors. Fir example i want to save and delete student , teacher and other entity. I have created actor for StudentDao.scala class StudentDao extends Actor with ActorLogging{ override def Receive = { case Add(student) => // Add to database case Delete => //Delete from database // Some other cases related to

Selective request-throttling using akka-http stream

痞子三分冷 提交于 2019-12-11 06:45:28
问题 I got one API which calls two another Downstream APIs. One downstream api ( https://test/foo ) is really important and it is very fast. Another slow downstream api ( https://test/bar ) has its limitation, the throughput of it only can handle 50 requests per sec. I would like to make sure the downstream api https://test/foo has more priority than https://test/bar . For example, if the API thread pool is 75, I only allow 50 parallel incoming connection to go through https://test/bar . Rest of