创建与节流器一起使用的速率

Create a Rate for use with Throttler

正在关注来自 API 的文档 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

我需要单独导入吗?

是的。尝试导入

akka.contrib.throttle.Throttler._