Guest User

Untitled

a guest
Jul 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import akka.persistence.common._
  2. import akka.persistence.redis._
  3. import akka.persistence.redis.RedisStorage._
  4. import akka.stm._
  5. import akka.actor.Actor
  6. import akka.actor.Actor._
  7.  
  8. class Perman extends Actor {
  9. val msglog = RedisStorage.getVector("svd.log")
  10.  
  11. def receive = {
  12. case msg: String =>
  13. atomic {
  14. msglog + msg.getBytes("UTF-8")
  15. }
  16. println(msglog.map(bytes => new String(bytes, "UTF-8")).toList)
  17.  
  18. case _ =>
  19. }
  20. }
  21.  
  22. object Test {
  23. def main(args: Array[String]): Unit = {
  24. val ref = actorOf[Perman].start
  25. ref ! "one"
  26. ref ! "two"
  27. }
  28. }
Add Comment
Please, Sign In to add comment