我在这样的演员中有一个案例对象:
object UserActor{
case object getResult
def props = Props(new UserActor)
}
class UserActor extends Actor {
def receive = {
case getResult =>
val reply = sender
reply ! "Hello world"
}
}
我想在路线中使用这个:
val route: Route =
path("users") { id =>
get {
complete {
userActor ? getResult
}
}
}
但是,我得到了错误,预计ToResponseMarshallable。那么问题,如何使用SprayJsonSupport编组案例对象?