Yes, that's what I was missing. Thanks a lot!

- Arno

Am 18.04.2017 um 13:45 schrieb Patrik Nordwall:
> When you start the entity type you can define a handOffStopMessage that
> will be sent to the entity actor when it should be stopped because of a
> rebalance or graceful shutdown. By default it is PoisonPill, but you can
> define your own custom message and then the entity actor can complete
> it's work before stopping itself.
> 
> /Patrik
> 
> On Tue, Apr 18, 2017 at 7:50 AM, Arno Haase
> <arno.ha...@haase-consulting.com
> <mailto:arno.ha...@haase-consulting.com>> wrote:
> 
>     Thanks for the fast reply! I am aware of CoordinatedShutdown, and I love
>     it - it's exactly what I've been re-coding for every Akka system ;-)
> 
>     For the special case of ShardedRegion however I did not find a way to do
>     the sequence I described in my original post, specifically giving time
>     to sharded entities to finish their current work *after* the region
>     stopped accepting new commands. As far as I can see, coordinated
>     shutdown sends GracefulShutdown to the ShardRegion in
>     PhaseClusterShardingShutdownRegion, which then stops the ShardRegion
>     with its children.
> 
>     If I drain the shardede entities of their work before that - e.g. in
>     PhaseServiceRequestsDone - then what prevents other cluster nodes from
>     sending new commands to them afterwards or even starting new entities on
>     the node that is shutting down?
> 
>     Am 18.04.2017 um 07:33 schrieb Konrad Malawski:
>     > What you describe is exactly a feature we just rolled out in Akka 2.5.0 
> :-)
>     > Docs here:
>     > http://doc.akka.io/docs/akka/2.5/scala/actors.html#Coordinated_Shutdown
>     <http://doc.akka.io/docs/akka/2.5/scala/actors.html#Coordinated_Shutdown>
>     > It also handles other parts of Akka, such as cluster singletons, Akka
>     > HTTP and more.
>     >
>     > Akka 2.5 is binary compatible with 2.4 (except if a library touched some
>     > specific internals / private APIs - see the release notes for details),
>     > so you should be able to quickly hop onto it :-)
>     >
>     > Happy hakking!
>     >
>     > --
>     > Konrad `ktoso` Malawski
>     > Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>     >
>     > On 18 April 2017 at 14:31:24, Arno Haase
>     > (arno.ha...@haase-consulting.com 
> <mailto:arno.ha...@haase-consulting.com>
>     > <mailto:arno.ha...@haase-consulting.com
>     <mailto:arno.ha...@haase-consulting.com>>) wrote:
>     >
>     >> When shutting down an ActorSystem, I would like to shut down a
>     >> ShardRegion in three phases to ensure consistency:
>     >>
>     >> 1. Prevent sharded entities from receiving any new commands
>     >> 2. Let the sharded entities finish their work
>     >> 3. Actually shut down the ShardRegion, stopping all sharded
>     entities and
>     >> allowing other shards to start this shard's entities
>     >>
>     >> To give some context, in my case command processing involves some
>     >> interaction between sharded entities and other actors (e.g.
>     updating an
>     >> ElasticSearch index), so step 2 involves more than just stopping the
>     >> sharded entity actor.
>     >>
>     >> This looks like a common problem, but I found no API for doing step 1
>     >> without stopping sharded entity actors. In particular, sending
>     >> GracefulShutdown to the ShardRegion appears to do 1. and 3. without
>     >> allowing the application code to do 2.
>     >>
>     >> Am I missing something? Any help is appreciated.
>     >>
>     >> - Arno
>     >>
>     >>
>     >> --
>     >> >>>>>>>>>>      Read the docs: http://akka.io/docs/
>     >> >>>>>>>>>>      Check the FAQ:
>     http://doc.akka.io/docs/akka/current/additional/faq.html
>     <http://doc.akka.io/docs/akka/current/additional/faq.html>
>     >> >>>>>>>>>>      Search the archives:
>     https://groups.google.com/group/akka-user
>     <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
>     <mailto:akka-user%2bunsubscr...@googlegroups.com>
>     >> <mailto:akka-user%2bunsubscr...@googlegroups.com
>     <mailto:akka-user%252bunsubscr...@googlegroups.com>>.
>     >> To post to this group, send email to akka-user@googlegroups.com 
> <mailto:akka-user@googlegroups.com>
>     >> <mailto:akka-user@googlegroups.com
>     <mailto:akka-user@googlegroups.com>>.
>     >> Visit this group at https://groups.google.com/group/akka-user
>     <https://groups.google.com/group/akka-user>.
>     >> For more options, visit https://groups.google.com/d/optout
>     <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
>     <http://doc.akka.io/docs/akka/current/additional/faq.html>
>     >>>>>>>>>>      Search the archives:
>     https://groups.google.com/group/akka-user
>     <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
>     <mailto:akka-user%2bunsubscr...@googlegroups.com>.
>     To post to this group, send email to akka-user@googlegroups.com
>     <mailto:akka-user@googlegroups.com>.
>     Visit this group at https://groups.google.com/group/akka-user
>     <https://groups.google.com/group/akka-user>.
>     For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> 
> 
> 
> -- 
> 
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.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 akka-user+unsubscr...@googlegroups.com
> <mailto:akka-user+unsubscr...@googlegroups.com>.
> To post to this group, send email to akka-user@googlegroups.com
> <mailto:akka-user@googlegroups.com>.
> Visit this group at https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to