Akka: issue with Timer

The timers are being started and the Timeout message is being sent, but your Consumer actor isn’t handling it, so the println never executes.

Your apply injects timers into Consumer. In idle, you’re starting the timer, then calling action to construct a new Behavior, but you then throw it away and actually use the same behavior your actor has (which won’t respond to any messages).

idle should probably be defined along these lines (I’m also using the duration DSL: import scala.concurrent.duration._)

timers.startTimerWithFixedDelay(TimerKey, Timeout, 1.second)
action()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top