当前位置: 首页>>代码示例>>Scala>>正文


Scala Service类代码示例

本文整理汇总了Scala中com.lightbend.lagom.scaladsl.api.Service的典型用法代码示例。如果您正苦于以下问题:Scala Service类的具体用法?Scala Service怎么用?Scala Service使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Service类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: Lagomneo4jsampleService

//设置package包名称以及导入依赖的类
package com.inocybe.lagomneo4jsample.api

import akka.{Done, NotUsed}
import com.inocybe.lagomneo4jsample.model.RecipeOut
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}

object Lagomneo4jsampleService {
  val entityId: String = "my-entity"
}
trait Lagomneo4jsampleService extends Service {

  
  def getRecipe(id: String): ServiceCall[NotUsed, RecipeOut]

  override final def descriptor = {
    import Service._
    // @formatter:off
    named("recipe-service").withCalls(
      restCall(Method.POST,   "/recipes/",    this.addRecipe),
      restCall(Method.GET,    "/recipes/:id", getRecipe _)
    ).withAutoAcl(true)
    // @formatter:on
  }
} 
开发者ID:botekchristophe,项目名称:lagom-neo4j-sample,代码行数:26,代码来源:Lagomneo4jsampleService.scala

示例2: useGreeting

//设置package包名称以及导入依赖的类
package sample.helloworld.api

import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.broker.Topic
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import sample.helloworld.api.model.GreetingMessage


  def useGreeting(id: String): ServiceCall[GreetingMessage, Done]

  override final def descriptor = {
    import Service._
    // @formatter:off
    named("hello").withCalls(
      pathCall("/api/hello/:id", hello _),
      pathCall("/api/hello/:id", useGreeting _)
    ).withTopics(
          topic(HelloService.TOPIC_NAME, greetingsTopic)
     ).withAutoAcl(true)
    // @formatter:on
  }

  // The topic handle
  def greetingsTopic(): Topic[GreetingMessage]
}

object HelloService  {
  val TOPIC_NAME = "wordCount"
} 
开发者ID:knoldus,项目名称:lagom-scala-wordcount.g8,代码行数:30,代码来源:HelloService.scala

示例3: descriptor

//设置package包名称以及导入依赖的类
package sample.helloworldconsumer.api

import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.transport.Method
import play.api.libs.json.{Format, Json}

trait HelloConsumerService extends Service {

  override def descriptor = {
    import Service._

    named("wordCounts").withCalls(
      restCall(Method.GET, "/api/wordcount", findTopHundredWordCounts _),
      restCall(Method.GET, "/api/foo", foo)
    ).withAutoAcl(true)
  }

  def findTopHundredWordCounts(): ServiceCall[NotUsed, Map[String, Int]]

  def foo(): ServiceCall[NotUsed, String]

  case class WordDetails(word: String, count: String)

  object WordDetails {
    implicit val format: Format[WordDetails] = Json.format
  }
} 
开发者ID:knoldus,项目名称:lagom-scala-wordcount.g8,代码行数:29,代码来源:HelloConsumerService.scala

示例4: createAccount

//设置package包名称以及导入依赖的类
package org.ioreskovic.greatmaterialcontinuum.api

import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}

trait AccountService extends Service {

  def createAccount(): ServiceCall[Account, Done]

  def deleteAccount(username: String): ServiceCall[NotUsed, Done]

  def activateAccount(username: String): ServiceCall[NotUsed, Done]

  def deactivateAccount(username: String): ServiceCall[NotUsed, Done]

  def getAccount(username: String): ServiceCall[NotUsed, Account]

  override final def descriptor: Descriptor = {
    import Service._
    // @formatter:off
    named("accounts")
      .withCalls(
        restCall(Method.POST, "/api/accounts/", createAccount _),
        restCall(Method.DELETE, "/api/accounts/:username", deleteAccount _),
        restCall(Method.GET, "/api/accounts/:username/activation", activateAccount _),
        restCall(Method.GET, "/api/accounts/:username/deactivation", deactivateAccount _),
        restCall(Method.GET, "/api/accounts/:username", getAccount _)
      )
      .withAutoAcl(true)
    // @formatter:on
  }
} 
开发者ID:ioreskovic,项目名称:great-material-continuum,代码行数:34,代码来源:AccountService.scala

示例5: createPlayer

//设置package包名称以及导入依赖的类
package com.chriswk.gameranker.player.api

import java.util.UUID

import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import play.api.libs.json.{Format, Json}

trait PlayerService extends Service {
  def createPlayer: ServiceCall[CreatePlayer, Player]

  def getPlayer(playerId: UUID): ServiceCall[NotUsed, Player]

  def getPlayers: ServiceCall[NotUsed, Seq[Player]]

  override def descriptor = {
    import Service._
    named("player").withCalls(
      pathCall("/api/player", createPlayer),
      pathCall("/api/player/:id", getPlayer _),
      pathCall("/api/player", getPlayers)
    )
  }
}

case class Player(id: UUID, name: String)

object Player {
  implicit val format: Format[Player] = Json.format
}

case class CreatePlayer(name: String)

object CreatePlayer {
  implicit val format: Format[CreatePlayer] = Json.format
} 
开发者ID:chriswk,项目名称:gameranker,代码行数:37,代码来源:PlayerService.scala

示例6: CollectSSHService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.collect.ssh.api

import akka.Done
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import org.wex.cmsfs.common.`object`.CoreMonitorDetailForSsh

object CollectSSHService {
  val SERVICE_NAME = "collect-ssh"
}

trait CollectSSHService extends Service {

  def pushCollectItem: ServiceCall[CoreMonitorDetailForSsh, Done]

  override final def descriptor = {
    import Service._
    import CollectSSHService._
    named(SERVICE_NAME).withCalls(
      restCall(Method.POST, "/v1/collect", pushCollectItem)
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:24,代码来源:CollectSSHService.scala

示例7: NotificationService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.notification.impl

import com.lightbend.lagom.scaladsl.api.{CircuitBreaker, Service, ServiceCall}

object NotificationService {
  val SERVICE_NAME = "notification"
}

trait NotificationService extends Service {

  def pushNotificationItem: ServiceCall[String, String]

  override final def descriptor = {
    import NotificationService._
    import Service._
    named(SERVICE_NAME).withCalls(
      pathCall("/mns-web/services/rest/msgNotify", pushNotificationItem)
        .withCircuitBreaker(CircuitBreaker.identifiedBy("alarm-circuitbreaker"))
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:22,代码来源:NotificationService.scala

示例8: ElasticsearchService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.elasticsearch.api

import akka.Done
import com.lightbend.lagom.scaladsl.api.{CircuitBreaker, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.transport.Method

object ElasticsearchService {
  val SERVICE_NAME = "elastic-search"
}

trait ElasticsearchService extends Service {

  def pushElasticsearchItem(_index: String, _type: String): ServiceCall[String, Done]

  override final def descriptor = {
    import ElasticsearchService._
    import Service._
    named(SERVICE_NAME).withCalls(
      restCall(Method.POST, "/:_index/:_type", pushElasticsearchItem _)
        .withCircuitBreaker(CircuitBreaker.identifiedBy("elasticsearch-circuitbreaker"))
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:24,代码来源:ElasticsearchService.scala

示例9: FormatAnalyzeService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.format.analyze.api

import akka.Done
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}

object FormatAnalyzeService {
  val SERVICE_NAME = "format-analyze"
}

trait FormatAnalyzeService extends Service {

  def pushFormatAnalyze: ServiceCall[FormatAnalyzeItem, Done]

  override final def descriptor = {
    import FormatAnalyzeService._
    import Service._
    named(SERVICE_NAME).withCalls(
      pathCall("/v1/format/analyze", pushFormatAnalyze)
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:22,代码来源:FormatAnalyzeService.scala

示例10: MonitorService

//设置package包名称以及导入依赖的类
package ogr.wex.cmsfs.monitor.api

import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import org.wex.cmsfs.config.api.CoreMonitorStatus

object MonitorService {
  val SERVICE_NAME = "monitor"
}

trait MonitorService extends Service {

  def getMonitorStatus: ServiceCall[NotUsed, Seq[CoreMonitorStatus]]

  override final def descriptor = {
    import Service._
    import MonitorService._
    named(SERVICE_NAME).withCalls(
      restCall(Method.GET, "/v1/monitor/statuses", getMonitorStatus)
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:24,代码来源:MonitorService.scala

示例11: FormatAlarmService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.format.alarm.api

import akka.Done
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}

object FormatAlarmService {
  val SERVICE_NAME = "format-alarm"
}

trait FormatAlarmService extends Service {

  def pushFormatAlarm: ServiceCall[FormatAlarmItem, Done]

  override final def descriptor = {
    import FormatAlarmService._
    import Service._
    named(SERVICE_NAME).withCalls(
      pathCall("/v1/format/alarm", pushFormatAlarm)
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:22,代码来源:FormatAlarmService.scala

示例12: CollectJDBCService

//设置package包名称以及导入依赖的类
package org.wex.cmsfs.collect.jdbc.api

import akka.Done
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import org.wex.cmsfs.common.`object`.CoreMonitorDetailForJdbc

object CollectJDBCService {
  val SERVICE_NAME = "collect-jdbc"
}

trait CollectJDBCService extends Service {

  def pushCollectItem: ServiceCall[CoreMonitorDetailForJdbc, Done]

  override final def descriptor = {
    import Service._
    named(CollectJDBCService.SERVICE_NAME).withCalls(
      restCall(Method.POST, "/v1/collect", pushCollectItem)
    )
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:23,代码来源:CollectJDBCService.scala

示例13: Item

//设置package包名称以及导入依赖的类
package demo.api.basket

import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.broker.Topic
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.transport._
import demo.api.basket.ExtraTransportExceptions.CustomExceptionSerializer
import play.api.Environment
import play.api.libs.json.{Format, Json}

case class Item(name: String, price: Int)
object Item {
  implicit val itemFormat: Format[Item] = Json.format
}

case class Basket(items: Seq[Item], total: Int)
object Basket {
  implicit val basketFormat: Format[Basket] = Json.format
}

case class OrderPlaced(basketId: String, basket: Basket)
object OrderPlaced {
  implicit val orderPlacedFormat: Format[OrderPlaced] = Json.format
}

trait BasketService extends Service {
  def getBasket(basketId: String): ServiceCall[NotUsed, Basket]
  def getTotal(basketId: String): ServiceCall[NotUsed, Int]
  def addItem(basketId: String): ServiceCall[Item, NotUsed]
  def clearAll(basketId: String): ServiceCall[NotUsed, NotUsed]
  def placeOrder(basketId: String): ServiceCall[NotUsed, NotUsed]
  def placedOrders: Topic[OrderPlaced]

  override def descriptor: Descriptor = {
    import Method._
    import Service._

    named("basket").withCalls(
      restCall(GET, "/basket/:basketId", getBasket _),
      restCall(GET, "/basket/:basketId/total", getTotal _),
      restCall(POST, "/basket/:basketId/items", addItem _),
      restCall(DELETE, "/basket/:basketId/items", clearAll _),
      restCall(POST, "/basket/:basketId/order", placeOrder _)
    ).withTopics(
      topic("placed-orders", placedOrders)
    ).withExceptionSerializer(new CustomExceptionSerializer(Environment.simple()))
  }
} 
开发者ID:tommpy,项目名称:demo-lagom-checkout,代码行数:49,代码来源:BasketService.scala

示例14: Item

//设置package包名称以及导入依赖的类
package demo.api.basket

import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.broker.Topic
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.transport._
import play.api.libs.json.{Format, Json}

case class Item(name: String, price: Int)
object Item {
  implicit val itemFormat: Format[Item] = Json.format
}

case class Basket(items: Seq[Item], total: Int)
object Basket {
  implicit val basketFormat: Format[Basket] = Json.format
}

case class OrderPlaced(basketId: String, basket: Basket)
object OrderPlaced {
  implicit val orderPlacedFormat: Format[OrderPlaced] = Json.format
}

trait BasketService extends Service {
  def getBasket(basketId: String): ServiceCall[NotUsed, Basket]
  def getTotal(basketId: String): ServiceCall[NotUsed, Int]
  def addItem(basketId: String): ServiceCall[Item, NotUsed]
  def clearAll(basketId: String): ServiceCall[NotUsed, NotUsed]
  def placeOrder(basketId: String): ServiceCall[NotUsed, NotUsed]
  def placedOrders: Topic[OrderPlaced]

  override def descriptor: Descriptor = {
    import Method._
    import Service._

    named("basket").withCalls(
      restCall(GET, "/basket/:basketId", getBasket _),
      restCall(GET, "/basket/:basketId/total", getTotal _),
      restCall(POST, "/basket/:basketId/items", addItem _),
      restCall(DELETE, "/basket/:basketId/items", clearAll _),
      restCall(POST, "/basket/:basketId/order", placeOrder _)
    ).withTopics(
      topic("placed-orders", placedOrders)
    )
  }
} 
开发者ID:tommpy,项目名称:demo-lagom-checkout,代码行数:47,代码来源:BasketService.scala

示例15: Item

//设置package包名称以及导入依赖的类
package demo.api.basket

import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.transport._
import play.api.libs.json.{Format, Json}

case class Item(name: String, price: Int)
object Item {
  implicit val itemFormat: Format[Item] = Json.format
}

case class Basket(items: Seq[Item], total: Int)
object Basket {
  implicit val basketFormat: Format[Basket] = Json.format
}

trait BasketService extends Service {
  def getBasket(basketId: String): ServiceCall[NotUsed, Basket]
  def getTotal(basketId: String): ServiceCall[NotUsed, Int]
  def addItem(basketId: String): ServiceCall[Item, NotUsed]

  override def descriptor: Descriptor = {
    import Method._
    import Service._

    named("basket").withCalls(
      restCall(GET, "/basket/:basketId", getBasket _),
      restCall(GET, "/basket/:basketId/total", getTotal _),
      restCall(POST, "/basket/:basketId/items", addItem _)
    )
  }
} 
开发者ID:tommpy,项目名称:demo-lagom-checkout,代码行数:34,代码来源:BasketService.scala


注:本文中的com.lightbend.lagom.scaladsl.api.Service类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。