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 <https://github.com/akka/akka/issues>. We should
improve this, and support this better, or reject invalid usage.

Thanks,
Patrik

On Tue, Jan 5, 2016 at 5:57 PM, <[email protected]> wrote:

> 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(_._1 == sessId)
> }
>
> val receiveCommand: Receive = {
>     case c @ RegisterClient(sbrId, sessId) ⇒
>       getActorRef(sessId) match {
>         case Some(a)                    ⇒
>           a ! ClientRegisteredWithNewActor(sender)
>           register(sessId, sender)
>         case None                       ⇒
>           register(sessId, sender)
>       }
> }
>
>
> The ClientDeRegistered event isn't the result of a command, but is
> persisted when this method executes, immediately after actor startup.
>
>   def checkAndDeRegisterNonLiveSubrClients {
>     subrClients.foreach { sc ⇒
>       getActorRef(sc._1).foreach { ar ⇒
>         performIfActorNotLive(ar, persistAndUpdate(ClientDeRegistered(sc.
> _1)))
>       }
>     }
>   }
>
>
>
> --
> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to