创建与Throttler一起使用的费率

时间:2015-04-10 09:20:35

标签: scala akka

关注API doc http://doc.akka.io/api/akka/2.3.9/index.html#akka.contrib.throttle.Throttler$$Rate 我设置了一个费率:

package akka.test

import java.util.concurrent.TimeUnit._
import scala.concurrent.duration.{ Duration, FiniteDuration }

object RateTest extends App {

  val rate2 = 1 msgsPer Duration(1, SECONDS)

}

但我收到编译器异常:

Multiple markers at this line:
◾value msgsPer is not a member of Int
◾value msgsPer is not a member of Int

我是否需要单独导入?

1 个答案:

答案 0 :(得分:2)

是。尝试导入

akka.contrib.throttle.Throttler._