Hi Måns, Good observation. That is indeed a serious documentation bug. Please create an issue <https://github.com/akka/akka/issues> and if you are interested in contributing a pull request would be awesome.
and, yes, the future must be created inside the Callable call. Regards, Patrik On Wed, Jul 2, 2014 at 1:57 PM, Måns Schultz <[email protected]> wrote: > Hello > > I'm playing around with circuit breakers at the moment (having so much > fun). However the documentation at: > > http://doc.akka.io/docs/akka/snapshot/common/circuitbreaker.html > > makes me abit confused. What makes me confused are the following lines: > > final Future<String> f = future( > new Callable<String>() { > public String call() { > return dangerousCall(); > } > }, getContext().dispatcher()); > > pipe(breaker.callWithCircuitBreaker( > new Callable<Future<String>>() { > public Future<String> call() throws Exception { > return f; > } > }), getContext().dispatcher()).to(getSender()); > > As I interpret this the future f will be run even if the circuit breaker > is open (which I guess is not what we want) since akka.dispatch.Futures.future > starts the computation regardless of the circuit breaker state. This would > in my mind mean that the returned result (piped to the sender) will still > fail fast but dangerousCall is still called and it's result ignored. If > dangerousCall would load some other service this could potentially be > bad. Would it not be better to move the future f inside > callWithCircuitBreaker? > > Best Regards > > Måns Schultz > > > > > > > > > -- > >>>>>>>>>> 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. > -- Patrik Nordwall Typesafe <http://typesafe.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 [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.
