• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala AhcWSComponents类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MyApplicationLoader

//设置package包名称以及导入依赖的类
import dao.CroissantDAO
import jobs.GmailJob
import play.api._
import play.api.ApplicationLoader.Context
import router.Routes
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.libs.mailer._
import play.api.i18n.I18nComponents
import play.modules.reactivemongo.{ReactiveMongoApiFromContext, ReactiveMongoComponents}
import services.OauthProvider
import utils.{Mailer, Settings}


class MyApplicationLoader extends ApplicationLoader {
  def load(context: Context) = {
    LoggerConfigurator(context.environment.classLoader).foreach(_.configure(context.environment))
    new MyComponents(context).application
  }
}

class MyComponents(context: Context) extends ReactiveMongoApiFromContext(context)
  with I18nComponents
  with AhcWSComponents
  with MailerComponents
  with ReactiveMongoComponents {

  implicit val ec = actorSystem.dispatcher

  val settings = new Settings(configuration)
  val mailer = new Mailer(settings, mailerClient)

  val croissantDAO = new CroissantDAO(settings, mailer, reactiveMongoApi)
  val oauthProvider = new OauthProvider(settings, wsClient)
  //val gmailJob = new GmailJob(wsClient, actorSystem, settings, mailer, croissantDAO)

  lazy val router = new Routes(
    httpErrorHandler,
    new controllers.CroissantController(settings, messagesApi, mailer, croissantDAO),
    new controllers.AdminCroissantController(settings, messagesApi, mailer, croissantDAO),
    new controllers.OauthController(oauthProvider),
    new controllers.Assets(httpErrorHandler)
  )
} 
开发者ID:denis-mludek,项目名称:zencroissants,代码行数:44,代码来源:MyApplicationLoader.scala


示例2: TenantEventProcessorSpec

//设置package包名称以及导入依赖的类
package optrak.lagomtest.tenant.impl

import java.util.concurrent.atomic.AtomicInteger

import akka.persistence.query.Sequence
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.server.LagomApplication
import com.lightbend.lagom.scaladsl.testkit.ServiceTest
import TenantEvents.{TenantCreated, TenantEvent}
import optrak.lagomtest.data.Data.TenantId
import optrak.lagomtest.utils.ReadSideTestDriver
import org.scalatest.{AsyncWordSpec, BeforeAndAfterAll, Matchers}
import play.api.libs.ws.ahc.AhcWSComponents

class TenantEventProcessorSpec extends AsyncWordSpec with BeforeAndAfterAll with Matchers {

  private val server = ServiceTest.startServer(ServiceTest.defaultSetup.withCassandra(true)) { ctx =>
    new LagomApplication(ctx) with TenantComponents with AhcWSComponents {
      override def serviceLocator = NoServiceLocator
      override lazy val readSide: ReadSideTestDriver = new ReadSideTestDriver
    }
  }

  override def afterAll() = server.stop()

  private val testDriver = server.application.readSide
  private val tenantRepository = server.application.tenantRepository
  private val offset = new AtomicInteger()


  "The tenant event processor" should {
    "create a tenant" in {
      val tenantCreated = TenantCreated("tim", "hello")
      for {
        _ <- feed(tenantCreated.id, tenantCreated)
        tenants <- getTenants
      } yield {
        tenants should contain only tenantCreated.id
      }
    }

  }

  private def getTenants = {
    tenantRepository.selectAllTenants
  }

  private def feed(tenantId: TenantId, event: TenantEvent) = {
    testDriver.feed(tenantId.toString, event, Sequence(offset.getAndIncrement))
  }
} 
开发者ID:TimPigden,项目名称:lagom-multitenant,代码行数:52,代码来源:TenantEventProcessorSpec.scala


示例3: Lagomneo4jsampleLoader

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

import com.inocybe.lagomneo4jsample.api.Lagomneo4jsampleService
import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import play.api.libs.ws.ahc.AhcWSComponents

class Lagomneo4jsampleLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new Lagomneo4jsampleApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new Lagomneo4jsampleApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[Lagomneo4jsampleService]
  )
}

abstract class Lagomneo4jsampleApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[Lagomneo4jsampleService].to(wire[Lagomneo4jsampleServiceImpl])
  )

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = Lagomneo4jsampleSerializerRegistry

  // Register the lagom-neo4j-sample persistent entity
  persistentEntityRegistry.register(wire[Lagomneo4jsampleEntity])
} 
开发者ID:botekchristophe,项目名称:lagom-neo4j-sample,代码行数:43,代码来源:Lagomneo4jsampleLoader.scala


示例4: Lagomneo4jsampleStreamLoader

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

import com.inocybe.lagomneo4jsamplestream.api.Lagomneo4jsampleStreamService
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import play.api.libs.ws.ahc.AhcWSComponents

class Lagomneo4jsampleStreamLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new Lagomneo4jsampleStreamApplication(context) {
      override def serviceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new Lagomneo4jsampleStreamApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[Lagomneo4jsampleStreamService]
  )
}

abstract class Lagomneo4jsampleStreamApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[Lagomneo4jsampleStreamService].to(wire[Lagomneo4jsampleStreamServiceImpl])
  )

  // Bind the Lagomneo4jsampleService client
  lazy val lagomneo4jsampleService = serviceClient.implement[Lagomneo4jsampleStreamService]
} 
开发者ID:botekchristophe,项目名称:lagom-neo4j-sample,代码行数:37,代码来源:Lagomneo4jsampleStreamLoader.scala


示例5: HelloLoader

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


import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.broker.kafka.LagomKafkaComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import play.api.libs.ws.ahc.AhcWSComponents
import sample.helloworld.api.HelloService

class HelloLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new HelloApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new HelloApplication(context) with LagomDevModeComponents
}

abstract class HelloApplication(context: LagomApplicationContext) extends HelloComponents(context)
    with LagomKafkaComponents
    {

}

abstract class HelloComponents(context: LagomApplicationContext) extends LagomApplication(context)
  with CassandraPersistenceComponents
with AhcWSComponents{


  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[HelloService].to(wire[HelloServiceImpl])
  )

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = HelloSerializerRegistry

  // Register the Hello persistent entity
  persistentEntityRegistry.register(wire[HelloEntity])
} 
开发者ID:knoldus,项目名称:lagom-scala-wordcount.g8,代码行数:47,代码来源:HelloLoader.scala


示例6: HelloConsumerLoader

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

import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.broker.kafka.LagomKafkaComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server.{LagomApplication, LagomApplicationContext, LagomApplicationLoader, LagomServer}
import com.softwaremill.macwire._
import play.api.libs.ws.ahc.AhcWSComponents
import sample.helloworld.api.HelloService
import sample.helloworldconsumer.api.HelloConsumerService
import sample.helloworldconsumer.impl.repositories.MessageRepository

class HelloConsumerLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new HelloConsumerApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new HelloConsumerApplication(context) with LagomDevModeComponents
}

abstract class HelloConsumerApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with LagomKafkaComponents
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[HelloConsumerService].to(wire[HelloConsumerServiceImpl])
  )

  //Bind the HelloService client
  lazy val helloService = serviceClient.implement[HelloService]

  lazy val messageRepository = wire[MessageRepository]

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = HelloConsumerSerializerRegistry

  // Register the Message persistent entity
   persistentEntityRegistry.register(wire[MessageEntity])

  readSide.register(wire[MessageEventProcessor])
} 
开发者ID:knoldus,项目名称:lagom-scala-wordcount.g8,代码行数:50,代码来源:HelloConsumerLoader.scala


示例7: LagomhandsondevelopmentStreamLoader

//设置package包名称以及导入依赖的类
package com.example.lagomhandsondevelopmentstream.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import com.example.lagomhandsondevelopmentstream.api.LagomhandsondevelopmentStreamService
import com.example.lagomhandsondevelopment.api.LagomhandsondevelopmentService
import com.softwaremill.macwire._

class LagomhandsondevelopmentStreamLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new LagomhandsondevelopmentStreamApplication(context) {
      override def serviceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new LagomhandsondevelopmentStreamApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[LagomhandsondevelopmentStreamService]
  )
}

abstract class LagomhandsondevelopmentStreamApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[LagomhandsondevelopmentStreamService].to(wire[LagomhandsondevelopmentStreamServiceImpl])
  )

  // Bind the LagomhandsondevelopmentService client
  lazy val lagomhandsondevelopmentService = serviceClient.implement[LagomhandsondevelopmentService]
} 
开发者ID:negokaz,项目名称:lagom-hands-on-development.scala,代码行数:38,代码来源:LagomhandsondevelopmentStreamLoader.scala


示例8: LagomhandsondevelopmentLoader

//设置package包名称以及导入依赖的类
package com.example.lagomhandsondevelopment.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import com.example.lagomhandsondevelopment.api.LagomhandsondevelopmentService
import com.softwaremill.macwire._

class LagomhandsondevelopmentLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new LagomhandsondevelopmentApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new LagomhandsondevelopmentApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[LagomhandsondevelopmentService]
  )
}

abstract class LagomhandsondevelopmentApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[LagomhandsondevelopmentService].to(wire[LagomhandsondevelopmentServiceImpl])
  )

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = LagomhandsondevelopmentSerializerRegistry

  // Register the lagom-hands-on-development persistent entity
  persistentEntityRegistry.register(wire[LagomhandsondevelopmentEntity])
} 
开发者ID:negokaz,项目名称:lagom-hands-on-development.scala,代码行数:43,代码来源:LagomhandsondevelopmentLoader.scala


示例9: AccountLoader

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

import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.broker.kafka.LagomKafkaComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import org.ioreskovic.greatmaterialcontinuum.api.AccountService
import org.ioreskovic.greatmaterialcontinuum.impl.ent.acc.{AccountEntity, AccountSerializerRegistry}
import play.api.libs.ws.ahc.AhcWSComponents

class AccountLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new AccountApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new AccountApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[AccountService]
  )
}

abstract class AccountApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with LagomKafkaComponents
    with AhcWSComponents {

  // Bind the service that this server provides
  override lazy val lagomServer = serverFor[AccountService](wire[AccountServiceImpl])

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = AccountSerializerRegistry

  // Register the great-material-continuum persistent entity
  persistentEntityRegistry.register(wire[AccountEntity])
} 
开发者ID:ioreskovic,项目名称:great-material-continuum,代码行数:44,代码来源:AccountLoader.scala


示例10: HelloStreamLoader

//设置package包名称以及导入依赖的类
package se.hultner.hellostream.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import se.hultner.hellostream.api.HelloStreamService
import se.hultner.hello.api.HelloService
import com.softwaremill.macwire._

class HelloStreamLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new HelloStreamApplication(context) {
      override def serviceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new HelloStreamApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[HelloStreamService]
  )
}

abstract class HelloStreamApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[HelloStreamService].to(wire[HelloStreamServiceImpl])
  )

  // Bind the HelloService client
  lazy val helloService = serviceClient.implement[HelloService]
} 
开发者ID:Hultner,项目名称:hello_scala_microservices,代码行数:38,代码来源:HelloStreamLoader.scala


示例11: HelloLoader

//设置package包名称以及导入依赖的类
package se.hultner.hello.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import se.hultner.hello.api.HelloService
import com.softwaremill.macwire._

class HelloLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new HelloApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new HelloApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[HelloService]
  )
}

abstract class HelloApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[HelloService].to(wire[HelloServiceImpl])
  )

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = HelloSerializerRegistry

  // Register the Hello persistent entity
  persistentEntityRegistry.register(wire[HelloEntity])
} 
开发者ID:Hultner,项目名称:hello_scala_microservices,代码行数:43,代码来源:HelloLoader.scala


示例12: PlayerApplication

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

import com.chriswk.gameranker.player.api.PlayerService
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import play.api.libs.ws.ahc.AhcWSComponents
import com.softwaremill.macwire._

abstract class PlayerApplication(context: LagomApplicationContext) extends LagomApplication(context)
  with AhcWSComponents
  with CassandraPersistenceComponents {

  override lazy val lagomServer = LagomServer.forServices(
    bindService[PlayerService].to(wire[PlayerServiceImpl])
  )

  persistentEntityRegistry.register(wire[PlayerEntity])
}

class PlayerApplicationLoader extends LagomApplicationLoader {
  override def load(context: LagomApplicationContext) = new PlayerApplication(context) {
    override def serviceLocator = NoServiceLocator
  }

  override def loadDevMode(context: LagomApplicationContext) =
    new PlayerApplication(context) with LagomDevModeComponents
} 
开发者ID:chriswk,项目名称:gameranker,代码行数:29,代码来源:PlayerApplicationLoader.scala


示例13: LagomshoppingStreamLoader

//设置package包名称以及导入依赖的类
package com.example.lagomshoppingstream.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import com.example.lagomshoppingstream.api.LagomshoppingStreamService
import com.example.lagomshopping.api.LagomshoppingService
import com.softwaremill.macwire._

class LagomshoppingStreamLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new LagomshoppingStreamApplication(context) {
      override def serviceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new LagomshoppingStreamApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[LagomshoppingStreamService]
  )
}

abstract class LagomshoppingStreamApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[LagomshoppingStreamService].to(wire[LagomshoppingStreamServiceImpl])
  )

  // Bind the LagomshoppingService client
  lazy val lagomshoppingService = serviceClient.implement[LagomshoppingService]
} 
开发者ID:code-star,项目名称:lagom-playground,代码行数:38,代码来源:LagomshoppingStreamLoader.scala


示例14: LagomshoppingLoader

//设置package包名称以及导入依赖的类
package com.example.lagomshopping.impl

import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.server._
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import play.api.libs.ws.ahc.AhcWSComponents
import com.example.lagomshopping.api.LagomshoppingService
import com.softwaremill.macwire._

class LagomshoppingLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new LagomshoppingApplication(context) {
      override def serviceLocator: ServiceLocator = NoServiceLocator
    }

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new LagomshoppingApplication(context) with LagomDevModeComponents

  override def describeServices = List(
    readDescriptor[LagomshoppingService]
  )
}

abstract class LagomshoppingApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with CassandraPersistenceComponents
    with AhcWSComponents {

  // Bind the services that this server provides
  override lazy val lagomServer = LagomServer.forServices(
    bindService[LagomshoppingService].to(wire[LagomshoppingServiceImpl])
  )

  // Register the JSON serializer registry
  override lazy val jsonSerializerRegistry = LagomshoppingSerializerRegistry

  // Register the LagomShopping persistent entity
  persistentEntityRegistry.register(wire[LagomshoppingEntity])
} 
开发者ID:code-star,项目名称:lagom-playground,代码行数:43,代码来源:LagomshoppingLoader.scala


示例15: ServiceApplicationLoader

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

import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.pubsub.PubSubComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import org.wex.cmsfs.collect.ssh.api.CollectSSHService
import org.wex.cmsfs.format.alarm.api.FormatAlarmService
import org.wex.cmsfs.format.analyze.api.FormatAnalyzeService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.libs.ws.ahc.AhcWSComponents

class ServiceApplicationLoader extends LagomApplicationLoader {

  override def loadDevMode(context: LagomApplicationContext): LagomApplication = {
    new ServiceApplication(context) with LagomDevModeComponents
  }

  override def load(context: LagomApplicationContext): LagomApplication = {
    Common.loaderEnvironment(context)
    new ServiceApplication(context) with ConsulServiceLocatorComponents
  }

}

abstract class ServiceApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents
    with PubSubComponents {

  override lazy val lagomServer = LagomServer.forServices(
    bindService[CollectSSHService].to(wire[CollectSSHServiceImpl])
  )

  val formatAlarmService = serviceClient.implement[FormatAlarmService]
  val formatAnalyzeService = serviceClient.implement[FormatAnalyzeService]

  val collectTopic = wire[CollectTopic]
  val collecting = wire[Collecting]
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:42,代码来源:ServiceApplicationLoader.scala


示例16: WebGateway

//设置package包名称以及导入依赖的类
import com.lightbend.lagom.scaladsl.api.{ServiceAcl, ServiceInfo}
import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.softwaremill.macwire._
import controllers.{Assets, Main}
import ogr.wex.cmsfs.monitor.api.MonitorService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.ApplicationLoader.Context
import play.api.i18n.I18nComponents
import play.api.libs.ws.ahc.AhcWSComponents
import play.api.{ApplicationLoader, BuiltInComponentsFromContext, Mode}
import router.Routes

import scala.collection.immutable
import scala.concurrent.ExecutionContext

abstract class WebGateway(context: Context) extends BuiltInComponentsFromContext(context)
  with I18nComponents
  with AhcWSComponents
  with LagomServiceClientComponents {

  override lazy val serviceInfo: ServiceInfo = ServiceInfo(
    "web-gateway",
    Map(
      "web-gateway" -> immutable.Seq(ServiceAcl.forPathRegex("(?!/api/).*"))
    )
  )
  override implicit lazy val executionContext: ExecutionContext = actorSystem.dispatcher
  override lazy val router = {
    val prefix = "/"
    wire[Routes]
  }

  lazy val monitorService = serviceClient.implement[MonitorService]
  lazy val main = wire[Main]
  lazy val assets = wire[Assets]
}

class WebGatewayLoader extends ApplicationLoader {
  override def load(context: Context) = {
    Common.loaderEnvironment(context)
    println(context.environment.mode)

    context.environment.mode match {
      case Mode.Dev =>
        new WebGateway(context) with LagomDevModeComponents {}.application
      case _ =>
        new WebGateway(context) with ConsulServiceLocatorComponents {}.application
    }
  }
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:53,代码来源:Loader.scala


示例17: ServiceApplicationLoader

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

import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.pubsub.PubSubComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import org.wex.cmsfs.elasticsearch.api.ElasticsearchService
import org.wex.cmsfs.format.analyze.api.FormatAnalyzeService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.libs.ws.ahc.AhcWSComponents

class ServiceApplicationLoader extends LagomApplicationLoader {
  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new ServiceApplication(context) with LagomDevModeComponents

  override def load(context: LagomApplicationContext): LagomApplication = {
    Common.loaderEnvironment(context)
    new ServiceApplication(context) with ConsulServiceLocatorComponents
  }
}

abstract class ServiceApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents
    with PubSubComponents {
  override lazy val lagomServer = LagomServer.forServices(
    bindService[FormatAnalyzeService].to(wire[FormatAnalyzeServiceImpl])
  )

  val elasticsearchService = serviceClient.implement[ElasticsearchService]

  val topic = wire[FormatAnalyzeTopic]
  val action = wire[FormatAnalyzeAction]
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:36,代码来源:ServiceApplicationLoader.scala


示例18: ServiceApplicationLoader

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

import com.lightbend.lagom.scaladsl.client.LagomServiceClientComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import ogr.wex.cmsfs.monitor.api.MonitorService
import org.wex.cmsfs.collect.jdbc.api.CollectJDBCService
import org.wex.cmsfs.collect.ssh.api.CollectSSHService
import org.wex.cmsfs.config.api.ConfigService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.libs.ws.ahc.AhcWSComponents

class ServiceApplicationLoader extends LagomApplicationLoader {
  override def load(context: LagomApplicationContext): LagomApplication = {
    Common.loaderEnvironment(context)
    new ServiceApplication(context) with ConsulServiceLocatorComponents
  }
}

abstract class ServiceApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents
    with LagomServiceClientComponents {

  override lazy val lagomServer = LagomServer.forServices(
    bindService[MonitorService].to(wire[MonitorServiceImpl])
  )

  val configService = serviceClient.implement[ConfigService]
  val collectSSHService = serviceClient.implement[CollectSSHService]
  val collectJDBCService = serviceClient.implement[CollectJDBCService]

  val bootstrapActionCollect = wire[MonitorActionCollect]
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:36,代码来源:ServiceApplicationLoader.scala


示例19: ServiceApplicationLoader

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

import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.pubsub.PubSubComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import org.wex.cmsfs.format.alarm.api.FormatAlarmService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import org.wex.cmsfs.notification.impl.NotificationService
import play.api.libs.ws.ahc.AhcWSComponents

class ServiceApplicationLoader extends LagomApplicationLoader {
  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new ServiceApplication(context) with LagomDevModeComponents

  override def load(context: LagomApplicationContext): LagomApplication = {
    Common.loaderEnvironment(context)
    new ServiceApplication(context) with ConsulServiceLocatorComponents
  }
}

abstract class ServiceApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents
    with PubSubComponents {
  override lazy val lagomServer = LagomServer.forServices(
    bindService[FormatAlarmService].to(wire[FormatAlarmServiceImpl])
  )

  val notificationService = serviceClient.implement[NotificationService]

  val topic = wire[FormatAlarmTopic]
  val action = wire[FormatAlarmAction]
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:36,代码来源:ServiceApplicationLoader.scala


示例20: ServiceApplicationLoader

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

import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.pubsub.PubSubComponents
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire._
import org.wex.cmsfs.collect.jdbc.api.CollectJDBCService
import org.wex.cmsfs.format.alarm.api.FormatAlarmService
import org.wex.cmsfs.format.analyze.api.FormatAnalyzeService
import org.wex.cmsfs.lagom.service.discovery.Common
import org.wex.cmsfs.lagom.service.discovery.consul.ConsulServiceLocatorComponents
import play.api.libs.ws.ahc.AhcWSComponents

class ServiceApplicationLoader extends LagomApplicationLoader {
  override def loadDevMode(context: LagomApplicationContext): LagomApplication = {
    new ServiceApplication(context) with LagomDevModeComponents
  }

  override def load(context: LagomApplicationContext): LagomApplication = {
    Common.loaderEnvironment(context)
    new ServiceApplication(context) with ConsulServiceLocatorComponents
  }
}

abstract class ServiceApplication(context: LagomApplicationContext)
  extends LagomApplication(context)
    with AhcWSComponents
    with PubSubComponents {

  override lazy val lagomServer = LagomServer.forServices(
    bindService[CollectJDBCService].to(wire[CollectJDBCServiceImpl])
  )

  val formatAlarmService = serviceClient.implement[FormatAlarmService]
  val formatAnalyzeService = serviceClient.implement[FormatAnalyzeService]

  val collectTopic = wire[CollectTopic]
  val collecting = wire[Collecting]
} 
开发者ID:shinhwagk,项目名称:cmsfs,代码行数:40,代码来源:ServiceApplicationLoader.scala



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala OFormat类代码示例发布时间:2022-05-23
下一篇:
Scala _类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap