【发布时间】:2017-02-17 14:20:02
【问题描述】:
我正在创建 lagom 简单的应用程序,定义一个休息端点并使用休息客户端邮递员到达终点。但作为回应,我得到了未找到操作的错误。我将 Akka 与 lagom 集成,以下是我的代码:
服务:
trait TwitterSchedulerService extends Service {
def doWork: ServiceCall[NotUsed, Done]
override def descriptor: Descriptor = {
import Service._
named("scheduler").withCalls(
call(doWork)
)
}
}
ServiceImpl:
class TwitterSchedulerServiceImpl(system: ActorSystem) extends TwitterSchedulerService {
override def doWork = ServiceCall { _ =>
Future {
println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ")
Done
}
}
}
加载器配置:
class TwitterLoader extends LagomApplicationLoader {
override def load(context: LagomApplicationContext): LagomApplication =
new TwitterApplication(context) {
override def serviceLocator = NoServiceLocator
}
}
object TwitterSerializerRegistry extends JsonSerializerRegistry {
override val serializers = Vector(
JsonSerializer[String]
)
}
abstract class TwitterApplication(context: LagomApplicationContext) extends LagomApplication(context)
with CassandraPersistenceComponents with AhcWSComponents {
override lazy val lagomServer = LagomServer.forServices(
bindService[TwitterSchedulerService].to(wire[TwitterSchedulerServiceImpl])
)
override lazy val jsonSerializerRegistry = TwitterSerializerRegistry
}
我正在关注 lagom 文档 http://www.lagomframework.com/documentation/1.3.x/scala/Akka.html。我想知道,为什么会出现这个错误,event all rest points are defined???
【问题讨论】:
-
嗨@harmeet-singh-taara,您可以发布错误消息和您用来测试代码的
curl命令吗? -
当然,
GET request http://localhost:9000/doWork。 @ignasi35 我正在使用 Postman,但未找到响应 404。 -
当我使用
GET request with http://localhost:57211/doWorkurl 时。我的请求过程很好。但是还是不明白,为什么9000发帖不灵了?
标签: scala rest akka http-status-code-404 lagom