> 22 mar 2014 kl. 03:03 skrev Justin du coeur <[email protected]>:
> 
> Quick question, before I spend time on this.  The following is simplified, 
> but hopefully clear.
> 
> Say I have a bunch of Actors representing Conversations.  These Conversations 
> are persistent, but live as Actors while they are active.  They are owned by 
> a ConversationManager Actor, which routes all messages to them.
> 
> Now I want these Conversations to time out, with the Manager shutting down 
> the child after some period of inactivity.  Is there an established trait for 
> managing this?
> 
Not that I know about, but I described something similar somewhere:
- all messages are sent via the Manager actor, which creates child Aggregate 
instances on demand
- when receiving a message the Manager extract the Aggregate identifier from 
the message
- the Manager creates a new child Aggregate actor if it doesn't exist, and then 
forwards the message to the Aggregate
- the Aggregate can passivate itself by sending a Passivate message to the 
parent Manager, which then sends PoisonPill to the Aggregate
- in-between receiving Passivate and Terminated the Manager will buffer all 
incoming messages for the passivating Aggregate
- when receiving Terminated it will flush the buffer for the Aggregate, which 
can result in activation again

The PoisonPill can be replaced with some other custom stop message if the 
Aggregate needs to do further interactions with other actors before stopping.


> I realize that the problem isn't rocket science.  But it occurred to me that 
> it can't be a rare pattern - I think I'm going to want variants of this in 
> several places in my app, and I think the code is more or less identical, so 
> there should be a common trait to boil out of this.  Has anyone written that 
> yet?
> 
Similar is implemented in cluster sharding, but not general purpose.

Let us know if you come up with something that is usable for others, might be a 
great contribution.

/Patrik
> -- 
> >>>>>>>>>> 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 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 [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/d/optout.

Reply via email to