I have the actor below which prints the result of a Future, then makes the same request after a delay, ad infinitum.Based on "scheduling Periodic Messages" here:
http://doc.akka.io/docs/akka/snapshot/scala/howto.html Can someone please point me in the right direction to do the same with Akka streams. Or would I do best to make this actor an ActorProducer? class PeriodicStatus(client: APIClient, delay: FiniteDuration) extends Actor { import context._ override def preStart() = context.system.scheduler.scheduleOnce(delay, self, "tick") // override postRestart so we don't call preStart and schedule a new message override def postRestart(reason: Throwable) = {} def receive = { case "tick" => { val message = client.getStatus.map(s => PeriodicStatus.Result(s)).recover { case ex => PeriodicStatus.Failure(ex) } message pipeTo self } case PeriodicStatus.Result(status) => { println(s"Status = $status") context.system.scheduler.scheduleOnce(delay, self, "tick") } case PeriodicStatus.Failure(e) => { println(s"Error = $e") context.system.scheduler.scheduleOnce(delay, self, "tick") } } } -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
