Hi all,
I am trying to send a message to an actorRef, 5 seconds apart, for each
line in a file. Here's how I'm attempting to do this:
val filename = "conf/my_file.json"
val lines = scala.io.Source.fromFile(filename).getLines.toList
for (line <- lines) {
Akka.system.scheduler.scheduleOnce(5 seconds) {
testStream ! Message(line)
}
}
In this case testStream is the actorRef. The behavior I have here is
unexpected. Instead of having each line messaged with a 5 second delay,
there is instead an initial delay of 5 seconds, then it seems like
testStream ! Message(line) is being invoked as it normally would for the
number of lines in the file. Instead what I was hoping was to still retain
that initial 5 second delay, send testStream a message, go to the next line
in the file, then send another Message in 5 seconds and so forth.
What am I doing wrong here that's causing that behavior to not go through?
Thanks for the help.
Matthew
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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/groups/opt_out.