--
You received this message because you are subscribed to the Google Groups "Concurrent Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concurrent-ru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I added my current test file to the gist: https://gist.github.com/schmurfy/d3ba8cdbc4c1f943cdb2#file-linking-rbHow can I achieve that ?What I tried is to pass the master reference as an argument when spawning the other actors and in their initialize method to link to the master with "master << :link", it works but they receive the :reset message in their on_message() method instead of being restarted, I tried with :supervise but with the same result.After your anwser I tried to play with supervision, what I wanted to achieve is this:I have one actor called "master" which will get spawned first with "supervise: true" so it is restarted on failure, this part works, then I want to add a bunch of actors which will be spawned after the master but need to be linked to it and restarted if the master is (maybe after a crash).On 30 October 2014 08:48, Petr Chalupa <chalu...@post.cz> wrote:Hi, about supervision trees: they are not fully baked e.q. a failing parent will not pause all its children. But you can build multiple levels of supervising and add what is need for your use-case in the actor or by adding new Behavior. I would like to fix this for v0.8.
my bad, my last attempt was 2 days ago and I gave up unable to achieve it but right now while trying to build a gist I managed to do it as it looks :pI would appreciate if you could have a look to see if it could be done better: https://gist.github.com/schmurfy/d3ba8cdbc4c1f943cdb2#file-linking-rbOn 11 November 2014 13:40, Petr Chalupa <chalu...@post.cz> wrote:Do you have a gist pls?On Tue, Nov 11, 2014 at 11:31 AM, Schmurfy <schm...@gmail.com> wrote:My idea behind this is that listener subscribe to specific messages so if the master (which sends them the messages) dies they should be restarted to subscribe again to ensure they receive the messages, in that case I could possibly do it differently but that's also a good exercise.If I get your previous answer correctly this is possible but I just can't figure out how, none of my attempts resulted in the listeners being restarted.if the master dies for whatever reason the listener should be restarted too and link again to it.each listener is spawned as supervised (by the root actor) and are given a reference to the master to link to itI made some attempts but I still fails at creating this:the master is spawned as supervised (by the root actor)On 6 November 2014 10:01, Petr Chalupa <chalu...@post.cz> wrote:Thanks! I am glad you like it and I appreciate your nice words.The linking works as you've described. Linked actor gets the events and can react accordingly. Supervisor is linked and on top of that it tells the supervised actor what to do on error. Supervised actor pauses on error and waits for message from supervisor, it can be :terminate!, :resume!, :reset!, or :restart!.Yep that makes sense and it's possible. The global actor is Actor.root and it resets any supervised actor. This is not configurable, to use different strategy an user has to spawn and use different supervisor.Petr