如何配置Akka路由器?

时间:2017-04-10 16:24:10

标签: scala akka

尝试配置路由器时,我发现我缺少一些配置。

例外:

select
    meas.MEAS_VALUE
  , rec.pat_id
  , [Max ET] = meas.ENTRY_TIME
from ip_flwsht_rec rec
  inner join (
    select *
      , rn = row_number() over (partition by fsd_id order by ENTRY_TIME desc)
    from [CLARITY].[dbo].[IP_FLWSHT_MEAS]
    ) as meas 
        on rec.fsd_id=meas.FSD_ID 
       and meas.rn = 1 /* just the latest row based on `entry_time` */
       and meas.flo_meas_id='14' 
       and meas.MEAS_VALUE is not null
where meas.ENTRY_TIME>=(dateadd(day, datediff(day, 0,getdate()) - 548, 0))
    and rec.pat_id = 'CENSORED'

这就是akka配置的样子(在Caused by: akka.ConfigurationException: Configuration missing for router [akka://UPS/user/sqs-poller-2/router1] in 'akka.actor.deployment' section. at akka.routing.FromConfig.verifyConfig(RouterConfig.scala:320) at akka.routing.RoutedActorRef.<init>(RoutedActorRef.scala:39) at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:795) ... 34 common frames omitted 中):

application.conf

Scala代码:

akka {
 actor.deployment {
     /parent/router1 {
       router = round-robin-pool
       nr-of-instances = 4
    }
  }
  loggers = ["akka.event.slf4j.Slf4jLogger"]
  loglevel = "debug"
  logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
  logger-startup-timeout = 30s
}

此设置是否正确?我怎样才能确切地知道配置中缺少的是什么?

1 个答案:

答案 0 :(得分:4)

根据错误消息,您必须提供以下配置。

   actor.deployment {
       /sqs-poller-2/router1 {
          router = round-robin-pool
          nr-of-instances = 4
       }
    }

在您的情况下,您在名为sqs-poller-2的顶级actor中创建路由器actor,因此部署路径以父actor的名称开头,后跟名为router1的路由器actor。