Search in sources :

Example 1 with WatcherActor

use of cn.vobile.akka.actor.WatcherActor in project lzl_workspace by hpulzl.

the class SpringDiActorService method doSpringActor.

public void doSpringActor(ApplicationContext applicationContext) {
    // 获取actorSystem
    ActorSystem actorSystem = (ActorSystem) applicationContext.getBean("actorSystem");
    // 初始化数据
    springExtension.initialize(applicationContext);
    ActorRef actorRef = actorSystem.actorOf(springExtension.props("integrationWithSpringActor"), "integrationWithSpringActor");
    // 监听actor执行完毕后,直接退出system
    actorSystem.actorOf(Props.create(WatcherActor.class, actorRef), "watcherActor");
    actorRef.tell(1, ActorRef.noSender());
}
Also used : ActorSystem(akka.actor.ActorSystem) ActorRef(akka.actor.ActorRef) WatcherActor(cn.vobile.akka.actor.WatcherActor)

Aggregations

ActorRef (akka.actor.ActorRef)1 ActorSystem (akka.actor.ActorSystem)1 WatcherActor (cn.vobile.akka.actor.WatcherActor)1