Just create a terminator actor, then ask it from the shutdown hook. The
actor then initiates the leaving process from the cluster, subscribes for
the relevant event and once done, replies to the ask. From the caller side
it is just

Await.result((shutdownActor ? PleaseLeave).andThen(system.terminate),
10.seconds)

There is no need for extra support form the Akka side, especially since a
graceful shutdown might require domain specific retreat code in addition to
the Akka specific parts like leaving cluster.

-Endre

On Mon, Mar 21, 2016 at 10:43 AM, Guido Medina <oxyg...@gmail.com> wrote:

> You could if system.terminate() could do that for you as part of the
> cluster extension then I could simply Await for Future<Terminated> to be
> ready.
>
> On Monday, March 21, 2016 at 9:36:43 AM UTC, Akka Team wrote:
>>
>> But then you cannot expect a graceful removal from the cluster.
>>
>> -Endre
>>
>> On Fri, Mar 18, 2016 at 6:47 PM, Guido Medina <oxy...@gmail.com> wrote:
>>
>>> Won't happen, the micro-services are being sent Linux SIGTERM, which is
>>> why I'm hooking on the JVM shutdown.
>>>
>>> On Friday, March 18, 2016 at 5:26:01 PM UTC, Konrad Malawski wrote:
>>>>
>>>> I precisely explained for what event you need to wait :-)
>>>>
>>>> Proper graceful shutdown means you need to wait for *_your own_
>>>> address* to come back as *MemberRemoved* event,
>>>> and THEN you can shut down the actor system and JVM.
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Konrad 'ktoso’ Malawski
>>>> <http://akka.io>Akka <http://akka.io> @ Lightbend <http://typesafe.com>
>>>>
>>> --
>>> >>>>>>>>>> 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.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Akka Team
>> Typesafe - Reactive apps on the JVM
>> Blog: letitcrash.com
>> Twitter: @akkateam
>>
> --
> >>>>>>>>>> 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.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      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