Re: [akka-user] Re: persistentActor not receiving messages??

2015-11-06 Thread Ian Holsman
completely silent.


On Thu, Nov 5, 2015 at 11:58 PM, Patrik Nordwall <patrik.nordw...@gmail.com>
wrote:

> Didn't you see anything in the logs? I'm asking because if it is silent it
> is something we must improve.
>
> /Patrik
>
> fre 6 nov. 2015 kl. 01:28 skrev Ian Holsman <i...@holsman.com.au>:
>
>> Thanks Matheus.
>> That resolved the issue.
>>
>> Regards
>> Ian
>>
>> On Thu, Nov 5, 2015 at 6:17 PM, <matheuslima...@gmail.com> wrote:
>>
>>> I guess the problem is how you are setting the persistence plugin:
>>> Try change it:
>>>
>>>
>>>- akka.persistence.journal.plugin = "leveldb" ->
>>>
>>>- akka.persistence.journal.plugin = "akka.persistence.journal.leveldb"
>>>
>>>
>>>
>>>
>>>- akka.persistence.snapshot-store.plugin = "leveldb" ->
>>>
>>>
>>>- akka.persistence.snapshot-store.plugin = 
>>> "akka.persistence.snapshot-store.local"
>>>
>>>
>>> I don't know if leveldb has a snapshot plugin...
>>> By the way, in my experience, issues with send message to persistent
>>> actor normally are associated with persistence plugin settings. The actor
>>> cannot be initialized if there is problems with persistence.
>>>
>>>
>>> On Thursday, November 5, 2015 at 11:07:27 PM UTC, Ian Holsman wrote:
>>>
>>>> Hi.
>>>>
>>>> I'm having a bit of trouble at the moment, and I think it's due to me
>>>> upgrading to most recent versions of things.
>>>>
>>>> I was on 2.3.11 of akka & akka-persistence-experimental , and using
>>>> 1.0-RC3 of akka-http.
>>>>
>>>> I'm now on 2.4.0 / 1.0 respectively.
>>>>
>>>> I had to change the code (minor) due to syntax changes but I don't feel
>>>> it is that.
>>>> I also had to add a leveldb configuration area in application.conf
>>>> which i'm guessing is the issue.
>>>>
>>>> fwiw the actor works as a 'regular' actor in terms of actually
>>>> receiving the message .. this is my actor code.. (it should just print out
>>>> something but it doesn't).
>>>>
>>>> class VillageManager(nameGenerator:String) extends PersistentActor  with 
>>>> ActorLogging {
>>>>   override def persistenceId: String = s"village-manager"
>>>>   override def receiveRecover: Receive = {
>>>> case _ => log.error("VillageMgr - unknown")
>>>>   }
>>>>   override def receiveCommand: Receive = {
>>>> case _ =>
>>>>   println("in Actor")
>>>>   log.error("Undefined message")
>>>>   }
>>>> }
>>>>
>>>> object VillageManager {
>>>>   def props(nameGen: String): Props = Props(classOf[VillageManager], 
>>>> nameGen)
>>>> }
>>>>
>>>>
>>>> my application.conf is
>>>>
>>>> akka {
>>>>   log-dead-letters = 10
>>>>   log-dead-letters-during-shutdown = on
>>>>
>>>>   persistence {
>>>> snapshot-store {
>>>> plugin = "leveldb"
>>>> local.dir = "target/persistence/snapshots"
>>>> }
>>>>
>>>> journal {
>>>> plugin = "leveldb"
>>>> leveldb {
>>>> dir = "target/persistence/journal"
>>>> native = true
>>>> }
>>>> }
>>>>   }
>>>> }
>>>>
>>>> leveldb {
>>>>   dir = "target/persistence/journal"
>>>>   checksum: "off"
>>>>   class: "akka.persistence.journal.leveldb.LeveldbJournal"
>>>>   dir: "target/persistence/journal"
>>>>   fsync: "on"
>>>>   native: "on"
>>>>   plugin-dispatcher : 
>>>> "akka.persistence.dispatchers.default-plugin-dispatcher"
>>>>   replay-dispatcher : 
>>>> "akka.persistence.dispatchers.default-replay-dispatcher"
>>>> }
>>>>
>>>> my build.sbt is:
>>>>
>>>> import sbt.Keys._
>>>>
>>>> name := "projectName"
>>>>
>>>> version := "

Re: [akka-user] Re: persistentActor not receiving messages??

2015-11-05 Thread Ian Holsman
Thanks Matheus.
That resolved the issue.

Regards
Ian

On Thu, Nov 5, 2015 at 6:17 PM, <matheuslima...@gmail.com> wrote:

> I guess the problem is how you are setting the persistence plugin:
> Try change it:
>
> - akka.persistence.journal.plugin = "leveldb" ->
>
> - akka.persistence.journal.plugin = "akka.persistence.journal.leveldb"
>
>
> - akka.persistence.snapshot-store.plugin = "leveldb" ->
>
> - akka.persistence.snapshot-store.plugin = 
> "akka.persistence.snapshot-store.local"
>
>
> I don't know if leveldb has a snapshot plugin...
> By the way, in my experience, issues with send message to persistent actor
> normally are associated with persistence plugin settings. The actor cannot
> be initialized if there is problems with persistence.
>
>
> On Thursday, November 5, 2015 at 11:07:27 PM UTC, Ian Holsman wrote:
>
>> Hi.
>>
>> I'm having a bit of trouble at the moment, and I think it's due to me
>> upgrading to most recent versions of things.
>>
>> I was on 2.3.11 of akka & akka-persistence-experimental , and using
>> 1.0-RC3 of akka-http.
>>
>> I'm now on 2.4.0 / 1.0 respectively.
>>
>> I had to change the code (minor) due to syntax changes but I don't feel
>> it is that.
>> I also had to add a leveldb configuration area in application.conf which
>> i'm guessing is the issue.
>>
>> fwiw the actor works as a 'regular' actor in terms of actually receiving
>> the message .. this is my actor code.. (it should just print out something
>> but it doesn't).
>>
>> class VillageManager(nameGenerator:String) extends PersistentActor  with 
>> ActorLogging {
>>   override def persistenceId: String = s"village-manager"
>>   override def receiveRecover: Receive = {
>> case _ => log.error("VillageMgr - unknown")
>>   }
>>   override def receiveCommand: Receive = {
>> case _ =>
>>   println("in Actor")
>>   log.error("Undefined message")
>>   }
>> }
>>
>> object VillageManager {
>>   def props(nameGen: String): Props = Props(classOf[VillageManager], nameGen)
>> }
>>
>>
>> my application.conf is
>>
>> akka {
>>   log-dead-letters = 10
>>   log-dead-letters-during-shutdown = on
>>
>>   persistence {
>> snapshot-store {
>> plugin = "leveldb"
>> local.dir = "target/persistence/snapshots"
>> }
>>
>> journal {
>> plugin = "leveldb"
>> leveldb {
>> dir = "target/persistence/journal"
>> native = true
>> }
>> }
>>   }
>> }
>>
>> leveldb {
>>   dir = "target/persistence/journal"
>>   checksum: "off"
>>   class: "akka.persistence.journal.leveldb.LeveldbJournal"
>>   dir: "target/persistence/journal"
>>   fsync: "on"
>>   native: "on"
>>   plugin-dispatcher : 
>> "akka.persistence.dispatchers.default-plugin-dispatcher"
>>   replay-dispatcher : 
>> "akka.persistence.dispatchers.default-replay-dispatcher"
>> }
>>
>> my build.sbt is:
>>
>> import sbt.Keys._
>>
>> name := "projectName"
>>
>> version := "1.0"
>>
>> scalaVersion := "2.11.7"
>>
>> resolvers += "Typesafe Repository" at 
>> "http://repo.typesafe.com/typesafe/releases/;
>>
>> resolvers += "bintray/meetup" at "http://dl.bintray.com/meetup/maven;
>>
>> val akkaVersion = "2.4.0"
>> val akkaStream = "1.0"
>>
>> scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
>> libraryDependencies ++= Seq(
>>   "com.typesafe.akka" %% "akka-actor" % akkaVersion,
>>   "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
>>   "com.typesafe.akka" %% "akka-persistence" % akkaVersion,
>>   "com.typesafe.akka" % "akka-http-core-experimental_2.11" % akkaStream,
>>   "com.typesafe.akka" % "akka-http-experimental_2.11" % akkaStream,
>>   "com.typesafe.akka" % "akka-stream-experimental_2.11" % akkaStream,
>>   "io.jvm.uuid" %% "scala-uuid" % "0.2.1",
>>   "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.1&

[akka-user] persistentActor not receiving messages??

2015-11-05 Thread Ian Holsman
Hi.

I'm having a bit of trouble at the moment, and I think it's due to me
upgrading to most recent versions of things.

I was on 2.3.11 of akka & akka-persistence-experimental , and using 1.0-RC3
of akka-http.

I'm now on 2.4.0 / 1.0 respectively.

I had to change the code (minor) due to syntax changes but I don't feel it
is that.
I also had to add a leveldb configuration area in application.conf which
i'm guessing is the issue.

fwiw the actor works as a 'regular' actor in terms of actually receiving
the message .. this is my actor code.. (it should just print out something
but it doesn't).

class VillageManager(nameGenerator:String) extends PersistentActor
with ActorLogging {
  override def persistenceId: String = s"village-manager"
  override def receiveRecover: Receive = {
case _ => log.error("VillageMgr - unknown")
  }
  override def receiveCommand: Receive = {
case _ =>
  println("in Actor")
  log.error("Undefined message")
  }
}

object VillageManager {
  def props(nameGen: String): Props = Props(classOf[VillageManager], nameGen)
}


my application.conf is

akka {
  log-dead-letters = 10
  log-dead-letters-during-shutdown = on

  persistence {
snapshot-store {
plugin = "leveldb"
local.dir = "target/persistence/snapshots"
}

journal {
plugin = "leveldb"
leveldb {
dir = "target/persistence/journal"
native = true
}
}
  }
}

leveldb {
  dir = "target/persistence/journal"
  checksum: "off"
  class: "akka.persistence.journal.leveldb.LeveldbJournal"
  dir: "target/persistence/journal"
  fsync: "on"
  native: "on"
  plugin-dispatcher : "akka.persistence.dispatchers.default-plugin-dispatcher"
  replay-dispatcher : "akka.persistence.dispatchers.default-replay-dispatcher"
}

my build.sbt is:

import sbt.Keys._

name := "projectName"

version := "1.0"

scalaVersion := "2.11.7"

resolvers += "Typesafe Repository" at
"http://repo.typesafe.com/typesafe/releases/;

resolvers += "bintray/meetup" at "http://dl.bintray.com/meetup/maven;

val akkaVersion = "2.4.0"
val akkaStream = "1.0"

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % akkaVersion,
  "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
  "com.typesafe.akka" %% "akka-persistence" % akkaVersion,
  "com.typesafe.akka" % "akka-http-core-experimental_2.11" % akkaStream,
  "com.typesafe.akka" % "akka-http-experimental_2.11" % akkaStream,
  "com.typesafe.akka" % "akka-stream-experimental_2.11" % akkaStream,
  "io.jvm.uuid" %% "scala-uuid" % "0.2.1",
  "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.1",
  "org.scalatest" %% "scalatest" % "2.2.5",
  "junit" % "junit" % "4.12" % "test",
  "org.iq80.leveldb" % "leveldb" % "0.7",
  "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8",
  "com.meetup" %% "archery" % "0.4.0"
)


lazy val root = (project in file(".")).enablePlugins(SbtTwirl)


I'm at a loss on how to debug this.


-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
>>>>>>>>>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] how to extract the (json) string out of a (Akka-http) RequestEntity

2015-01-16 Thread Ian Holsman
I'm not saying this is the best way..

val postDataF: Future[ByteString] =
entity.dataBytes.fold(ByteString()) { (z, i) = z.concat(i)}
val postData: String = Await.result(postDataF, 50.millis).decodeString(UTF-8)



On Sat, Jan 17, 2015 at 12:26 AM, Robin Bakkerus
robin.bakke...@gmail.com wrote:
 Can some one help me with (I think) a very simply question, but one I could
 not figure out myself yet.

 It is about how extract the (json) string out of the RequestEntity, inside a
 HttpRequest

 From the command line I give a command like this:
 curl -i -H Accept: application/json -H Content-Type:application/json -X
 POST --data '{value:{id:1}' http://localhost:8000/saveTsta

 And this should be handled by an Akka-http server like this:

  def requestHandler(req: HttpRequest): Future[HttpResponse] = req match {
 case HttpRequest(POST, Uri.Path(/saveTsta), _, _, _)=
 saveTsta(req)
 case _: HttpRequest   =
 unknownReq(req)
   }


 def saveTsta(req: HttpRequest): Future[HttpResponse] = {
 val entity:RequestEntity = req.entity

 val json:String = how_do_get_the_json_data_out_of(entity) ???
 }

 Txs in advance

 --
 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 akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: [akka-persistence] Testing systems which have Persistence

2015-01-06 Thread Ian Holsman
That's exactly what I needed.

Thanks Anders.
(I put it in my akka.conf)

On Tue, Jan 6, 2015 at 2:41 AM, Anders Båtstrand ander...@gmail.com wrote:
 Ah, I did not understand that.

 I have solved that by starting a new Akka system and a new JavaTestKit in
 each test, and doing the test code in a static initializer. Before, I switch
 to the in-mem journal using system properties.

 In my abstract super-class:



 private ActorSystem system;

 @Before
 public void startAkka() {
 system = ActorSystem.create(TestSys, ConfigFactory.load()
 .withValue(akka.persistence.journal.plugin,
 fromAnyRef(akka.persistence.journal.inmem)));
 }

 @After
 public void stoppAkka() {
 system.shutdown();
 system.awaitTermination();
 }

 protected ActorSystem system() {
 return system;
 }


 And in my tests:

 @Test
 public void test() {
 new JavaTestKit(system()) {{
 // test code

 }};
 }




 JavaTestKit is (afaik) just a wrapper around the Akka system, so if you have
 common code used in more than one test, just send in the system as a
 parameter, and create a new JavaTestKit.

 If you use Scala, this can probably (?) be done in a different way, I would
 not know...

 Kind regards,

 Anders


 kl. 04:04:05 UTC+1 tirsdag 6. januar 2015 skrev Ian Holsman følgende:

 Thanks for answering Anders, your answers were very helpful.

 for #1 (starting in a known state). I was more asking how do I start
 with a 'fresh/clean' journal with no history. I can manually remove
 the files, but I was hoping there was something in the test-kit I
 could do which will achieve this so I can do the tests in my IDE.



 On Mon, Jan 5, 2015 at 6:55 AM, Anders Båtstrand ande...@gmail.com
 wrote:
  I have only been using Akka Persistence for a few months, but this is my
  suggestions:
 
  1. I always start empty, but that is possibly not what you want. Maybe a
  file based storage, and you copy the files in place right before you
  start
  the Akka system?
 
  2. I have solved the same problem by letting the parent actor be
  responsible
  for killing the children. That is: The child receives an event that it
  calculates should result in it's own destruction, and it then calls the
  parent, which then kills it (and updates a map over actors). In my case
  the
  parent is also delegating messages to the child, so this way I am sure
  not
  to send messages to any actor that is on the way down (that is, before
  the
  parent received the Terminated-message).
 
  3. I am not sure i understood the question. I have CreateChild and
  KillChild
  events persistent from the parent actor. During recovery, it makes a map
  over actors it should create or not, and only creates then
  onRecoveryComplete. That way I do not create actors I would immediatly
  kill.
 
  Hope this was helpful!
 
  Best regards,
 
  Anders Båtstrand
 
  kl. 19:20:30 UTC+1 fredag 2. januar 2015 skrev Ian Holsman følgende:
 
  Hi.
 
  I'm building a 'toy' game that makes uses of akka-persistence, in order
  to
  learn it.
 
  in a nutshell the game is 1000's of people/bots create villages, they
  act
  independently of each other, and generally pass messages to each other
  to
  chat/fight and all that good stuff.
 
  Where I am having problems are:
 
  1. how do I initialize the persistence system at the start of testing
  so I
  am in a 'known state' when I start.
 
  2. how I assign IDs (persistanceId)  to actors.
  Ideally I would use a map reference for while the villages exist, and
  be
  able to re-use them if a new village is created. but the problem is it
  finds
  the old village, and replays all the events (including the death event
  which
  kills it).
  I don't mind re-using a old actor, but i'd like to stop it (ie
  poisonpill)
  when it isn't active.
 
  It seems like they need to be unique for the life of the system, and to
  do
  so I would need a counter in place or GUIDs. but then I would need to
  keep
  track of the Map reference/GUID mapping meaning my code would need to
  first
  talk to the mapping holder, and then to the village itself (2 messages,
  1
  sync) which seems like non-ideal. (as opposed to
  context.actorselection(XYZ
  map-reference) ! message which I guess is still 2 messages under the
  covers, 1 sync too)
 
  3. the recovery log only seems to 'start' when I bring up the actor.
  Is there a way to know which actors are currently 'active' and just let
  Akka start them all up, instead of me keeping a list/map of 'active'
  villages, and manually restarting them.
 
 
 
  Thanks ..
 
  Ian.
 
  --
  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 akka-user+...@googlegroups.com

Re: [akka-user] Finding other actors

2015-01-05 Thread Ian Holsman
Thanks Patricks!
I try using the 'xxxManager' approach..

Regards
Ian

On Mon, Jan 5, 2015 at 11:00 AM, Patrick Mahoney patr...@auvik.com wrote:
 I have had some success instantiating and exposing ActorRef vals within an
 extension - http://doc.akka.io/docs/akka/snapshot/scala/extending-akka.html.
 This works well for actors that should be singletons within a given
 ActorSystem - you get this from extensions.

 -Patrick

 On 29 December 2014 at 16:19, Ian Holsman i...@holsman.com.au wrote:

 Hi.

 I was wondering what the best practice was for finding a running
 instance of an certain class of actor. (say 'bank account')

 Currently I have a BankAccountManager which creates a new bank
 account, and uses a map to store my reference # with the actorRef.

 I then use a 'GetAccountById' message to lookup the actorRef  on the
 BankAccountManager actor and pass it back to the caller. who then
 interacts with the bank account. (which seems pretty Kludgy to me).


 I recently came across the 'context.actorSelection' call, and was
 wondering if I should be using this instead to find it, and if this is
 the preferred way of dealing with finding actors.

 ie. never hold-on to ActorRefs, and just use actorSelection to find them.

 or is there a better pattern I should be using.

 Thanks!
 Ian


 --
 Ian Holsman
 i...@holsman.com.au
 PH: + 61-3-9028 8133 / +1-(425) 998-7083

 --
   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 akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: [akka-persistence] Testing systems which have Persistence

2015-01-05 Thread Ian Holsman
Thanks for answering Anders, your answers were very helpful.

for #1 (starting in a known state). I was more asking how do I start
with a 'fresh/clean' journal with no history. I can manually remove
the files, but I was hoping there was something in the test-kit I
could do which will achieve this so I can do the tests in my IDE.



On Mon, Jan 5, 2015 at 6:55 AM, Anders Båtstrand ander...@gmail.com wrote:
 I have only been using Akka Persistence for a few months, but this is my
 suggestions:

 1. I always start empty, but that is possibly not what you want. Maybe a
 file based storage, and you copy the files in place right before you start
 the Akka system?

 2. I have solved the same problem by letting the parent actor be responsible
 for killing the children. That is: The child receives an event that it
 calculates should result in it's own destruction, and it then calls the
 parent, which then kills it (and updates a map over actors). In my case the
 parent is also delegating messages to the child, so this way I am sure not
 to send messages to any actor that is on the way down (that is, before the
 parent received the Terminated-message).

 3. I am not sure i understood the question. I have CreateChild and KillChild
 events persistent from the parent actor. During recovery, it makes a map
 over actors it should create or not, and only creates then
 onRecoveryComplete. That way I do not create actors I would immediatly kill.

 Hope this was helpful!

 Best regards,

 Anders Båtstrand

 kl. 19:20:30 UTC+1 fredag 2. januar 2015 skrev Ian Holsman følgende:

 Hi.

 I'm building a 'toy' game that makes uses of akka-persistence, in order to
 learn it.

 in a nutshell the game is 1000's of people/bots create villages, they act
 independently of each other, and generally pass messages to each other to
 chat/fight and all that good stuff.

 Where I am having problems are:

 1. how do I initialize the persistence system at the start of testing so I
 am in a 'known state' when I start.

 2. how I assign IDs (persistanceId)  to actors.
 Ideally I would use a map reference for while the villages exist, and be
 able to re-use them if a new village is created. but the problem is it finds
 the old village, and replays all the events (including the death event which
 kills it).
 I don't mind re-using a old actor, but i'd like to stop it (ie poisonpill)
 when it isn't active.

 It seems like they need to be unique for the life of the system, and to do
 so I would need a counter in place or GUIDs. but then I would need to keep
 track of the Map reference/GUID mapping meaning my code would need to first
 talk to the mapping holder, and then to the village itself (2 messages, 1
 sync) which seems like non-ideal. (as opposed to context.actorselection(XYZ
 map-reference) ! message which I guess is still 2 messages under the
 covers, 1 sync too)

 3. the recovery log only seems to 'start' when I bring up the actor.
 Is there a way to know which actors are currently 'active' and just let
 Akka start them all up, instead of me keeping a list/map of 'active'
 villages, and manually restarting them.



 Thanks ..

 Ian.

 --
 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 akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] [akka-persistence] Testing systems which have Persistence

2015-01-02 Thread Ian Holsman
Hi.

I'm building a 'toy' game that makes uses of akka-persistence, in order to 
learn it.

in a nutshell the game is 1000's of people/bots create villages, they act 
independently of each other, and generally pass messages to each other to 
chat/fight and all that good stuff.

Where I am having problems are:

1. how do I initialize the persistence system at the start of testing so I 
am in a 'known state' when I start. 

2. how I assign IDs (persistanceId)  to actors. 
Ideally I would use a map reference for while the villages exist, and be 
able to re-use them if a new village is created. but the problem is it 
finds the old village, and replays all the events (including the death 
event which kills it). 
I don't mind re-using a old actor, but i'd like to stop it (ie poisonpill) 
when it isn't active.

It seems like they need to be unique for the life of the system, and to do 
so I would need a counter in place or GUIDs. but then I would need to keep 
track of the Map reference/GUID mapping meaning my code would need to first 
talk to the mapping holder, and then to the village itself (2 messages, 1 
sync) which seems like non-ideal. (as opposed to 
context.actorselection(XYZ map-reference) ! message which I guess is 
still 2 messages under the covers, 1 sync too)

3. the recovery log only seems to 'start' when I bring up the actor. 
Is there a way to know which actors are currently 'active' and just let 
Akka start them all up, instead of me keeping a list/map of 'active' 
villages, and manually restarting them.



Thanks .. 

Ian.

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Finding other actors

2014-12-29 Thread Ian Holsman
Hi.

I was wondering what the best practice was for finding a running
instance of an certain class of actor. (say 'bank account')

Currently I have a BankAccountManager which creates a new bank
account, and uses a map to store my reference # with the actorRef.

I then use a 'GetAccountById' message to lookup the actorRef  on the
BankAccountManager actor and pass it back to the caller. who then
interacts with the bank account. (which seems pretty Kludgy to me).


I recently came across the 'context.actorSelection' call, and was
wondering if I should be using this instead to find it, and if this is
the preferred way of dealing with finding actors.

ie. never hold-on to ActorRefs, and just use actorSelection to find them.

or is there a better pattern I should be using.

Thanks!
Ian


-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] [streaming] newbie Q's about time and scale

2014-05-29 Thread Ian Holsman
Hi.
I'm recently read about reactive streams, and want to know some more about
it.

In particular I was trying to use the 'Flow' methodology to replace some
existing log-analysis software, which does things like page views, unique
visitors and things like that in 5 minute blocks. It looks quite simple to
create the flows, and the 'esper' example I found looks really close.

but I have two questions.

how does one deal with time. specifically how do I set up a periodic
scheduler to tell the flow that it's time to emit results. (and ideally
allow my service to set the time based on input records and not use system
time, so I can do stuff like replaying logs)

and secondly how do I scale these flows to work over multiple machines.
Ideally I'd like to just hand a dozen machines to Akka and say 'go wild'
and let it figure it all out, but failing that how can I allocate resources
to a producer?

Thanks
Ian



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.