本文整理汇总了Scala中play.api.libs.concurrent.AkkaGuiceSupport类的典型用法代码示例。如果您正苦于以下问题:Scala AkkaGuiceSupport类的具体用法?Scala AkkaGuiceSupport怎么用?Scala AkkaGuiceSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AkkaGuiceSupport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: Module
//设置package包名称以及导入依赖的类
import java.time.Clock
import com.google.inject.AbstractModule
import errorhandler.ErrorHandler
import helpers.{SemesterModeCache, SessionCache}
import logic.actors.database.DatabaseActor
import logic.actors.fakeactivity.FakeActivityActor
import logic.actors.rss.{DeleteNewsActor, NewsReaderActor, RSSParseActor}
import logic.actors.schedule._
import logic.actors.spread.TweetActor
import model.schedule.data.MSchedule
import play.api.libs.concurrent.AkkaGuiceSupport
import services.{DatabaseService, FakeActivity, NewsFeedReader, ScheduleParser}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// bind actors
bindActor[RSSParseActor]("rssParser")
bindActor[NewsReaderActor]("NewsReader")
bindActor[DeleteNewsActor]("deleteNews")
// Ask Guice to create an instance of NewsFeedReader when the
// application starts.
bind(classOf[NewsFeedReader]).asEagerSingleton()
bindActor[CheckScheduleDateActor]("checkSchedule")
bind(classOf[ScheduleParser]).asEagerSingleton()
bind(classOf[FakeActivity]).asEagerSingleton()
bindActor[ScheduleDownloadActor]("scheduleDownloader")
bindActor[ShortCutParseActor]("shortcutParser")
bindActor[ScheduleParseActor]("parseActor")
bind(classOf[MSchedule])
bindActor[GroupParseActor]("groupParseActor")
bindActor[TweetActor]("tweetActor")
bindActor[FakeActivityActor]("fakeActivityActor")
bind(classOf[SemesterModeCache])
bind(classOf[SessionCache])
bindActor[DatabaseActor]("databaseActor")
bind(classOf[DatabaseService]).asEagerSingleton()
}
}
开发者ID:P1tt187,项目名称:spirit-play,代码行数:50,代码来源:Module.scala
示例2: Module
//设置package包名称以及导入依赖的类
package au.id.tmm.senatedb.api
import java.nio.file.Paths
import au.id.tmm.senatedb.api.persistence.population.DbPopulationActor
import au.id.tmm.senatedb.core.engine.{ParsedDataStore, TallyEngine}
import au.id.tmm.senatedb.core.model.flyweights.PostcodeFlyweight
import au.id.tmm.senatedb.core.rawdata.{AecResourceStore, RawDataStore}
import com.google.inject.{AbstractModule, Provides, Singleton}
import play.api.libs.concurrent.AkkaGuiceSupport
import scalikejdbc.{ConnectionPool, ConnectionPoolContext, MultipleConnectionPoolContext}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure(): Unit = {
bindActor[DbPopulationActor]("dbPopulationActor")
}
@Provides
def provideConnectionPoolContext(): ConnectionPoolContext =
MultipleConnectionPoolContext(ConnectionPool.DEFAULT_NAME -> ConnectionPool())
@Provides
@Singleton
def providePostcodeFlyweight: PostcodeFlyweight = PostcodeFlyweight()
@Provides
@Singleton
def provideParsedDataStore(rawDataStore: RawDataStore): ParsedDataStore = ParsedDataStore(rawDataStore)
@Provides
@Singleton
def provideRawDataStore(aecResourceStore: AecResourceStore): RawDataStore = RawDataStore(aecResourceStore)
@Provides
@Singleton
def provideAecResourceStore: AecResourceStore = AecResourceStore.at(Paths.get("rawData"))
@Provides
def provideTallyEngine: TallyEngine = TallyEngine
}
开发者ID:tmccarthy,项目名称:SenateDB,代码行数:43,代码来源:Module.scala
示例3: MailsendActorModule
//设置package包名称以及导入依赖的类
package modules
import play.api.{Configuration, Environment}
import play.api.inject.{Binding, Module}
import play.api.libs.concurrent.AkkaGuiceSupport
import actors.MailsendActor
import com.google.inject.AbstractModule
import schedulers.MailsendScheduler
class MailsendActorModule extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
bindActor[MailsendActor]("mailsend-actor")
}
}
class MailsendScheduleModule extends Module {
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = {
Seq(
bind[MailsendScheduler].toSelf.eagerly
)
}
}
开发者ID:bananapianist,项目名称:playfw_sample,代码行数:26,代码来源:MailsendModule.scala
示例4: HelloWorldActorModule
//设置package包名称以及导入依赖的类
package modules
import play.api.{Configuration, Environment}
import play.api.inject.{Binding, Module}
import play.api.libs.concurrent.AkkaGuiceSupport
import actors.HelloWorldActor
import com.google.inject.AbstractModule
import schedulers.HelloWorldScheduler
class HelloWorldActorModule extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
bindActor[HelloWorldActor]("hello-world-actor")
}
}
class HelloWorldScheduleModule extends Module {
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = {
Seq(
bind[HelloWorldScheduler].toSelf.eagerly
)
}
}
开发者ID:bananapianist,项目名称:playfw_sample,代码行数:26,代码来源:HelloWorldModule.scala
示例5: CustomerCountBatchActorModule
//设置package包名称以及导入依赖的类
package modules
import play.api.{Configuration, Environment}
import play.api.inject.{Binding, Module}
import play.api.libs.concurrent.AkkaGuiceSupport
import actors.CustomerCountBatchActor
import com.google.inject.AbstractModule
import schedulers.CustomerCountBatchScheduler
import akka.actor.ActorSystem
class CustomerCountBatchActorModule extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
bindActor[CustomerCountBatchActor]("CustomerCountBatch-actor")
}
}
class CustomerCountBatchScheduleModule extends Module {
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = {
Seq(
bind[CustomerCountBatchScheduler].toSelf.eagerly
)
}
}
开发者ID:bananapianist,项目名称:playfw_sample,代码行数:28,代码来源:CustomerCountBatchModule.scala
示例6: Module
//设置package包名称以及导入依赖的类
import com.google.inject.AbstractModule
import java.time.Clock
import play.api.libs.concurrent.AkkaGuiceSupport
import services.actors.{UserFilesUpdateActor, NewUserActor}
import services.{ApplicationTimer, AtomicCounter, Counter, DropboxService}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
bind(classOf[DropboxService]).asEagerSingleton()
// Set AtomicCounter as the implementation for Counter.
bind(classOf[Counter]).to(classOf[AtomicCounter])
bindActor[NewUserActor]("new-user-actor")
bindActor[UserFilesUpdateActor]("user-files-update-actor")
}
}
开发者ID:adav,项目名称:DropboxCollectorPOC,代码行数:26,代码来源:Module.scala
示例7: Module
//设置package包名称以及导入依赖的类
import com.google.inject.AbstractModule
import java.time.Clock
import play.api.libs.concurrent.AkkaGuiceSupport
import services.{ApplicationTimer, AtomicCounter, Counter}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
// Set AtomicCounter as the implementation for Counter.
bind(classOf[Counter]).to(classOf[AtomicCounter])
// bindActor[Character]("chatActor")
}
}
开发者ID:xjpz,项目名称:play-scala-websocket-demo,代码行数:23,代码来源:Module.scala
示例8: IncidentModule
//设置package包名称以及导入依赖的类
package modules
import javax.inject.{Inject, Named}
import actors.bots.IncidentActor
import actors.systems.ServiceManagerActor
import akka.actor.{ActorRef, ActorSystem}
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.ExecutionContext
class IncidentModule extends AbstractModule with AkkaGuiceSupport {
def configure() = {
bindActor[ServiceManagerActor]("ServiceManager-actor")
bindActor[IncidentActor]("Incident-actor")
bind(classOf[IncidentScheduler]).asEagerSingleton()
}
}
class IncidentScheduler @Inject()(val system: ActorSystem, @Named("Incident-actor") val incidentActor: ActorRef)(implicit ec: ExecutionContext)
{
// system.scheduler.schedule( 0.microseconds, 1.minutes, incidentActor,IncidentActor.Tick)
}
开发者ID:kryton,项目名称:SlackBot2,代码行数:30,代码来源:IncidentModule.scala
示例9: SlackModule
//设置package包名称以及导入依赖的类
package modules
import javax.inject.{Inject, Named}
import actors.systems.SlackTeamManager
import play.api.libs.concurrent.AkkaGuiceSupport
import akka.actor.{ActorRef, ActorSystem}
import com.google.inject.AbstractModule
import models.SlackSessionRepo
import play.api.Logger
import play.api.libs.concurrent.AkkaGuiceSupport
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.ExecutionContext
class SlackModule extends AbstractModule with AkkaGuiceSupport {
def configure() = {
bindActor[SlackTeamManager]("SlackTeamManager-actor")
bind(classOf[SlackTeamManagerLoader]).asEagerSingleton()
}
}
class SlackTeamManagerLoader @Inject()(val system: ActorSystem,
@Named("SlackTeamManager-actor") val teamManagerActor: ActorRef,
@Named("DR-actor") val drActor: ActorRef,
slackSessionRepo: SlackSessionRepo)(implicit ec: ExecutionContext)
{
val logger = Logger.logger
logger.warn("Slack Startup")
//slackSessionRepo.createIt()
teamManagerActor ! SlackTeamManager.Load(slackSessionRepo,drActor)
}
开发者ID:kryton,项目名称:SlackBot2,代码行数:37,代码来源:SlackModule.scala
示例10: ActorFactoryModule
//设置package包名称以及导入依赖的类
package com.yper.utils
import javax.inject.Inject
import akka.actor.{ActorRef, ActorSystem}
import com.google.inject.AbstractModule
import com.google.inject.name.Names
import com.yper.users.actors.UserActor
import play.api.libs.concurrent.AkkaGuiceSupport
import play.api.{Configuration, Environment}
class ActorFactoryModule @Inject() (
environment: Environment,
configuration: Configuration
) extends AbstractModule with AkkaGuiceSupport{
override def configure(): Unit = {
println(s"Configuring ActorFactoryModule!")
val actorSystem = ActorSystem.create("YperActorSystem")
lazy val userActor = actorSystem.actorOf(UserActor.props)
bind(classOf[ActorRef])
.annotatedWith(Names.named("userActor"))
.toInstance(userActor);
lazy val anotherUserActor = actorSystem.actorOf(UserActor.props)
bind(classOf[ActorRef])
.annotatedWith(Names.named("anotherUserActor"))
.toInstance(anotherUserActor);
}
}
开发者ID:vi-kas,项目名称:yper,代码行数:36,代码来源:ActorFactoryModule.scala
示例11: Module
//设置package包名称以及导入依赖的类
import java.time.Clock
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import modules.{Scheduler, SchedulerActor}
import services.{ApplicationTimer, AtomicCounter, Counter}
class Module extends AbstractModule with AkkaGuiceSupport{
override def configure(): Unit = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
bind(classOf[ApplicationTimer]).asEagerSingleton()
bind(classOf[Counter]).to(classOf[AtomicCounter])
//akka scheduler
bindActor[SchedulerActor]("scheduler-actor")
bind(classOf[Scheduler]).asEagerSingleton()
}
}
开发者ID:humayun0156,项目名称:tizarah,代码行数:20,代码来源:Module.scala
示例12: Module
//设置package包名称以及导入依赖的类
import com.google.inject.AbstractModule
import java.time.Clock
import services.{ApplicationTimer, WebSocketActor, WebSocketActorProvider, ListActor}
import play.api.{Environment, Configuration}
import play.api.libs.concurrent.AkkaGuiceSupport
import models.{UserRepository, SlickUserRepository, ItemRepository, SlickItemRepository}
class Module(environment: Environment, configuration: Configuration) extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
bind(classOf[UserRepository]).to(classOf[SlickUserRepository])
bind(classOf[ItemRepository]).to(classOf[SlickItemRepository])
bindActor[ListActor]("list-actor")
}
}
开发者ID:AxelTLarsson,项目名称:listan-server,代码行数:25,代码来源:Module.scala
示例13: Module
//设置package包名称以及导入依赖的类
import java.time.Clock
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import services.{ApplicationTimer, SquarerTypedFactory, SquarerUntypedActor}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
bindActor[SquarerUntypedActor]("squarerUntyped")
bind(classOf[SquarerTypedFactory])
}
}
开发者ID:scottkwalker,项目名称:play-guice-typed-akka,代码行数:20,代码来源:Module.scala
示例14: MetaDefaultDCOS
//设置package包名称以及导入依赖的类
package modules
import com.google.inject.AbstractModule
import com.ning.http.client.AsyncHttpClientConfigBean
import net.codingwell.scalaguice.ScalaModule
import play.api.libs.concurrent.AkkaGuiceSupport
import play.api.libs.ws.WSClient
import play.api.libs.ws.ning.NingWSClient
import services.{DCOSAuthTokenActor, DefaultMarathonClientFactory, MarathonClientFactory}
class MetaDefaultDCOS extends AbstractModule with ScalaModule with AkkaGuiceSupport {
override def configure(): Unit = {
bind[MarathonClientFactory].to[DefaultMarathonClientFactory]
bindActor[DCOSAuthTokenActor](DCOSAuthTokenActor.name)
val config = new AsyncHttpClientConfigBean()
config.setAcceptAnyCertificate(true)
config.setFollowRedirect(true)
val permissiveClient = NingWSClient(config)
bind[WSClient].annotatedWithName("permissive-wsclient").toInstance(permissiveClient)
}
}
开发者ID:GalacticFog,项目名称:gestalt-meta,代码行数:27,代码来源:MetaDefaultDCOS.scala
示例15: Module
//设置package包名称以及导入依赖的类
import com.google.inject.AbstractModule
import java.time.Clock
import play.api.libs.concurrent.AkkaGuiceSupport
import services.{ApplicationTimer, AtomicCounter, Counter}
import actors._
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
// Set AtomicCounter as the implementation for Counter.
bind(classOf[Counter]).to(classOf[AtomicCounter])
bindActor[TemperatureActor]("temp-actor")
}
}
开发者ID:rpridemore,项目名称:fermenter,代码行数:23,代码来源:Module.scala
示例16: SchedulerModule
//设置package包名称以及导入依赖的类
package scheduler
import javax.inject._
import akka.actor._
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
class SchedulerModule extends AbstractModule with AkkaGuiceSupport {
def configure() = {
bindActor[SchedulerActor]("scheduler")
bind(classOf[SchedulerStart]) asEagerSingleton
}
}
@Singleton
class SchedulerStart @Inject()(system: ActorSystem, @Named("scheduler") longRunningActor: ActorRef) {
system.scheduler.schedule(10 seconds, 120 seconds, longRunningActor, CheckForRoundUps)
}
开发者ID:adamtrousdale,项目名称:monzo-roundup,代码行数:23,代码来源:SchedulerModule.scala
示例17: Module
//设置package包名称以及导入依赖的类
import com.google.inject.AbstractModule
import java.time.Clock
import Actors.{SentimentAPI, TagCounter, TweetActor, TwitterStreamActor}
import play.api.libs.concurrent.AkkaGuiceSupport
import services.{ApplicationTimer, AtomicCounter, Counter}
class Module extends AbstractModule with AkkaGuiceSupport{
override def configure() = {
// Use the system clock as the default implementation of Clock
bind(classOf[Clock]).toInstance(Clock.systemDefaultZone)
// Ask Guice to create an instance of ApplicationTimer when the
// application starts.
bind(classOf[ApplicationTimer]).asEagerSingleton()
// Set AtomicCounter as the implementation for Counter.
bind(classOf[Counter]).to(classOf[AtomicCounter])
// bindActor[ConfiguredActor]("configured-actor")
bindActor[TagCounter]("tag-counter-actor")
bindActor[TweetActor]("tweet-actor")
bindActor[TwitterStreamActor]("stream-actor")
bindActor[SentimentAPI]("sentiment-actor")
}
}
开发者ID:hackstreetb0ys,项目名称:twitter-sentiment-api,代码行数:28,代码来源:Module.scala
示例18: AppModule
//设置package包名称以及导入依赖的类
package conf
import java.time.{Clock, ZoneId}
import akka.actor.{Actor, ActorRef, Props}
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier
import com.google.api.client.http.javanet.NetHttpTransport
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.util.store.AbstractDataStoreFactory
import com.google.inject.AbstractModule
import com.google.inject.name.Names
import com.google.inject.util.Providers
import controllers.AppController
import play.api.libs.concurrent.{Akka, AkkaGuiceSupport}
import services._
import services.support.SystemClock
import scala.reflect.ClassTag
class AppModule extends AbstractModule {
def configure = {
bind(classOf[AppController]).asEagerSingleton // in prod mode all dependencies of AppController get built at startup time
bind(classOf[AbstractDataStoreFactory]).to(classOf[RepositoryDataStoreFactory])
bind(classOf[GoogleIdTokenVerifier]).toInstance(new GoogleIdTokenVerifier.Builder(new NetHttpTransport, new JacksonFactory).build)
bind(classOf[Clock]).toInstance(new SystemClock(ZoneId.systemDefault()))
}
}
class AkkaModule extends AbstractModule with AkkaGuiceSupport {
def configure = {
bindActorNoEager[SuperSupervisorActor](SuperSupervisorActor.actorName)
bindActorFactory[UserSupervisorActor, UserSupervisorActor.Factory]
}
private def bindActorNoEager[T <: Actor : ClassTag](name: String, props: Props => Props = identity): Unit = {
binder.bind(classOf[ActorRef])
.annotatedWith(Names.named(name))
.toProvider(Providers.guicify(Akka.providerOf[T](name, props)))
}
}
开发者ID:phdezann,项目名称:connectus,代码行数:41,代码来源:Module.scala
示例19: Bindings
//设置package包名称以及导入依赖的类
package actors
import akka.actor.{Actor, ActorLogging, ActorSystem}
import lib.Cloudwatch
import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import scala.concurrent.ExecutionContext
class Bindings extends AbstractModule with AkkaGuiceSupport {
def configure = {
bindActor[MetricActor]("metric-actor")
}
}
object MetricActor {
object Messages {
case class Send(server: String, method: String, path: String, ms: Long, response: Int, organization: Option[String], partner: Option[String])
}
}
@javax.inject.Singleton
class MetricActor @javax.inject.Inject() (
config: lib.Config,
system: ActorSystem,
cloudwatch: Cloudwatch
) extends Actor with ActorLogging {
private[this] implicit val ec: ExecutionContext = system.dispatchers.lookup("metric-actor-context")
def receive = akka.event.LoggingReceive {
case msg @ MetricActor.Messages.Send(server, method, path, ms, response, organization, partner) => {
cloudwatch.recordResponseTime(server, method, path, ms, response, organization, partner)
}
case msg: Any => // noop
}
}
开发者ID:flowvault,项目名称:proxy,代码行数:39,代码来源:MetricActor.scala
示例20: EventBussProvider
//设置package包名称以及导入依赖的类
import javax.inject.Inject
import akka.actor.{ ActorRef, ActorSystem }
import akka.stream.Materializer
import com.github.j5ik2o.spetstore.adaptor.aggregate.{ CustomerMessageBroker, ItemTypeMessageBroker }
import com.github.j5ik2o.spetstore.adaptor.eventbus.EventBus
import com.google.inject.name.Names
import com.google.inject.{ AbstractModule, Provider }
import play.api.libs.concurrent.AkkaGuiceSupport
class EventBussProvider @Inject() (actorSystem: ActorSystem, materializer: Materializer) extends Provider[EventBus] {
override def get(): EventBus = {
EventBus.ofRemote(actorSystem)
}
}
class CustomerAggregateProvider @Inject() (actorSystem: ActorSystem, eventBus: EventBus) extends Provider[ActorRef] {
override def get(): ActorRef = {
CustomerMessageBroker(eventBus)(actorSystem)
}
}
class ItemTypeAggregateProvider @Inject() (actorSystem: ActorSystem, eventBus: EventBus) extends Provider[ActorRef] {
override def get(): ActorRef = {
ItemTypeMessageBroker(eventBus)(actorSystem)
}
}
class Module extends AbstractModule with AkkaGuiceSupport {
override def configure() = {
bind(classOf[SharedJournalStarter]).asEagerSingleton()
bind(classOf[EventBus])
.toProvider(classOf[EventBussProvider])
.asEagerSingleton()
bind(classOf[ActorRef])
.annotatedWith(Names.named("customer-aggregate"))
.toProvider(classOf[CustomerAggregateProvider])
.asEagerSingleton()
bind(classOf[ActorRef])
.annotatedWith(Names.named("item-type-aggregate"))
.toProvider(classOf[ItemTypeAggregateProvider])
.asEagerSingleton()
}
}
开发者ID:j5ik2o,项目名称:spetstore-cqrs-es-akka,代码行数:47,代码来源:Module.scala
注:本文中的play.api.libs.concurrent.AkkaGuiceSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论