【发布时间】:2021-02-28 22:26:03
【问题描述】:
我是 lagom scala 的新手。因为我使用弹性搜索将我的数据存储为文档。我也在运行外部 cassandra。当我调用一个操作将我的数据存储在 cassandra 和弹性搜索中时。因为我的数据数据成功存储在 cassandra 中,但没有存储在弹性搜索中。我也将所有依赖项都包含在 Loader 中,lagomUnmanagedServices 也用于弹性搜索。 我的弹性搜索加载器类
lazy val elasticSearch= serviceClient.implement[ElasticSearch]
lazy val indexStore:IndexStore[SearchResult]=wire[ElasticSearchIndexStore]
我用于弹性搜索的 build.sbt 文件是
lagomUnmanagedServices in ThisBuild := Map("elastic-search" -> "http://127.0.0.1:9200")
lagomCassandraEnabled in ThisBuild := false
lagomUnmanagedServices in ThisBuild := Map("cas_native" -> "http://localhost:9042")
弹性搜索服务调用
override def descriptor: Descriptor ={
named("elastic-search")
.withCalls(
restCall(Method.POST,"/:index/category/:id/_update",updateIndexCategory _)
.withAutoAcl(true)
我的特质服务方法
trait ElasticSearch extends Service
{
def updateIndexCategory(index:String,id:UUID):ServiceCall[UpdateIndexCategoryData,Done]
}
我也在外部运行弹性搜索。但我不知道为什么会显示此消息
com.lightbend.lagom.internal.scaladsl.registry.ScalaServiceRegistryClient [] - serviceName=[elastic-search] was not found. Hint: Maybe it was not started?
提前致谢。
【问题讨论】:
标签: scala web-services elasticsearch cassandra lagom