喷雾路由中的 CompleteWith 指令

CompleteWith directive in spray routing

您好,我想在我的测试 scala 项目中使用 completeWith 来使用 actor per request 模式,但是我无法从 spray 中获取对该指令的引用。我尝试使用完整的指令,并认为某处是磁铁,它会以我想要的方式响应,但是这个:

pathPrefix("search") {
  path("book" / "getAvailable") {
    get {
      respondWithMediaType(`application/json`) {
        complete(instanceOf[Seq[Book]]) { completeFunction =>

不工作。你知道 spray 中的指令和 Akka 中的 completeWith 一样吗?

回答是spray里没有completeWith,我用的是akka http,因为spray已经不开发了:

      completeWith(instanceOf[Seq[BookApp]]) { completeFunction =>
        system.actorOf(Props(new HandlerActor(bookService, authorService))) ! Handler.AllBooks(completeFunction)
      }