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


Scala AkkaGuiceSupport类代码示例

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


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


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