我正在尝试按照原始文档中的示例在 spray.io 中完成一项服务,但我遇到了错误消息:
could not find implicit value for parameter marshaller: spray.httpx.marshalling.ToResponseMarshaller[scala.concurrent.Future[AdImporterServiceActor.StatusOfImport]]
val adServiceRoute: Route = {
path("service" / "import" / "status") {
get {
respondWithMediaType(`text/plain`) {
complete {
adImporterService.ask(GetImportStatus)(1 second).mapTo[StatusOfImport]
}
}
}
}
}
implicit val importStatusMarshaller: Marshaller[StatusOfImport] =
Marshaller.of[StatusOfImport](ContentTypes.`text/plain`) { (value, contentType, ctx) =>
val string = "Hello marshalled status"
ctx.marshalTo(HttpEntity(contentType, string))
}
在哪里
case class StatusOfImport(statuses: Map[String, ImportStatus], activeRequests:Set[Import])
case class ImportStatusUpdate(adId: String, statusUpdate: ImportStatus)
我不确定我在这里错过了什么。有经验的大侠能指点一下吗?
谢谢