This would be the solution I would use: http://pastebin.com/pJVnHqcH
I am a little unsure about mat.stop() and the Supervision.stop(). Should the code work? I want to restart on every Exception thrown from any Flow,Source,Sink of the Runnable graph Am Freitag, 18. März 2016 11:28:23 UTC+1 schrieb drewhk: > > Hi, > > There is no such thing at the moment. > > The onComplete on the sink does not guarantee that the whole stream has > actually stopped, it only guarantees that the Sink itself was stopped > (which may or may not imply completion of the whole stream; think of > graphs). > > -Endre > > On Fri, Mar 18, 2016 at 11:25 AM, <john....@gmail.com <javascript:>> > wrote: > >> Hi, >> If a graph throws an Exception in any flow I want to restart the graph. >> >> Actually I would love to have something like Akka Actors >> OneForOneStrategy(10, Duration.create("1 minute")),,,, >> >> I couldn't find the right hints in the docs. What I am trying right now >> is this pseudo code: >> >> Function<Throwable, Supervision.Directive> decider = exc -> >> Supervision.stop(); >> Sink sink = ....; >> >> RunnableGraph<Future<Integer>> runnableGraph = takeGraph.toMat(sink, >> Keep.right()); >> >> ActorMaterializer mat = >> ActorMaterializer.create(ActorMaterializerSettings.create(system).withSupervisionStrategy(decider), >> system); >> >> runnableGraph.run(mat).onComplete(new OnComplete<Integer>() { >> public void onComplete(Throwable failure, Integer value) { >> ActorMaterializer mat2 = >> ActorMaterializer.create(ActorMaterializerSettings.create(system).withSupervisionStrategy(decider), >> system); >> runnableGraph.run(mat2); >> } >> }, system.dispatcher()); >> >> Obviously the above code would only restart once... >> Anyway is this the right direction? >> Is there an idiomatic way to setup restart of an Runablegraph when a >> Exception happens >> >> Write now I am thinking of creating a Supervision Actor and use it to init >> and restart the Runablegraph >> >> Many Greetings >> John >> >> >> >> -- >> >>>>>>>>>> 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 <javascript:>. >> To post to this group, send email to akka...@googlegroups.com >> <javascript:>. >> 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.