Re: [akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-06 Thread Patrik Nordwall
Yes, that is probably the reason. You must not call persist (or other methods of the PersistentActor) from other threads, such as future callbacks. On Wed, Jan 6, 2016 at 1:26 PM, wrote: > persist wasn't called from a constructor. Sorry, I should have shown this > function definition too. > > ``

Re: [akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-06 Thread joseph
persist wasn't called from a constructor. Sorry, I should have shown this function definition too. ``` def performIfActorNotLive(ar: ActorRef, f: => Unit) = { implicit val timeout = Timeout(Duration.create(5, TimeUnit.SECONDS)) try { (ar ? Identify(1)).mapTo[ActorIdentity].map { a

Re: [akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-06 Thread Patrik Nordwall
I think that it is currently not possible to use persist from the constructor. The earliest point you can use it is when you receive RecoveryCompleted. Please create an issue . We should improve this, and support this better, or reject invalid usage. Thanks, P

Re: [akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-05 Thread joseph
There are no collections in the pattern matching. var subrClients = Map.empty[SessionId,SerializedActorPath] val receiveRecover: Receive = { case ClientRegistered(sessId, actor)⇒ subrClients += sessId -> actor case ClientDeRegistered(sessId) ⇒ subrClients = subrClients. filterNot(

Re: [akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-05 Thread Konrad Malawski
Do you have some collections involved in the pattern match perhaps? Show us your receiveCommand / receiveRecover. --  Cheers, Konrad 'ktoso’ Malawski Akka @ Typesafe On 5 January 2016 at 15:55:18, matheusl...@sagaranatech.com (matheusl...@sagaranatech.com) wrote: Sorry, I've read fast your code

[akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-05 Thread matheuslima
Sorry, I've read fast your code. Em terça-feira, 5 de janeiro de 2016 11:54:07 UTC-3, mathe...@sagaranatech.com escreveu: > > Subr$ClientDeRegistered > Subr$ClientRegistered > > Em terça-feira, 5 de janeiro de 2016 11:45:31 UTC-3, jos...@evernym.us > escreveu: >> >> >> >> ClassCastException: mya

[akka-user] Re: ClassCastException when persisting events using akka-persistence

2016-01-05 Thread matheuslima
Subr$ClientDeRegistered Subr$ClientRegistered Em terça-feira, 5 de janeiro de 2016 11:45:31 UTC-3, jos...@evernym.us escreveu: > > > > ClassCastException: myapp.actors.subr.Subr$ClientDeRegistered cannot be > cast to myapp.actors.subr.Subr$ClientRegistered > at myapp.actors.subr.Subr$$anonfu