Will retry this many times before giving up and returning an error.
Composes all the Future transformations, gives resulting Future back.
Composes all the Future transformations, gives resulting Future back. This is the only 'run' function here, so, effectively we insist on timeouts for all futures.
By default NonFatal failures are caught and represented as a Try[A]. OTOH if a serviceErrorDefaultValue is provided than we log errors and default to that, result type remains A.
mandatory timeout we set on 'service call' Futures
'by name' parameter that evaluates to a Future[SomeServiceCallResult], this may be called multiple times if retry() is enabled.
Future[SomeServiceCallResult] if a default value is provided or Future[Try[SomeServiceCallResult]] in case there's no default, a 'checked exception' of sorts.
Unfortunately, some exceptions are 'data' and are important for control flow, in their unmodified/unwrapped form, this allows caller to enumerate them and even (optionally) transform to another exception type.
Unfortunately, some exceptions are 'data' and are important for control flow, in their unmodified/unwrapped form, this allows caller to enumerate them and even (optionally) transform to another exception type.
When we get one of these we don't want to retry() service calls, we don't want to wrap them with additional user message, we just want to pass them through.
Will return this value if a call fails or we fail to interpret results.
Enables call tracing via provided callback function.
Enables call tracing via provided callback function. E.g. you can log call times or send metrics somewhere.
will be called with the results of a call.
A convenience wrapper around Future-based calls.
Typically we have an API that returns some Future[OpResult] and we need to set an operation timeout, possibly provide a default value, possibly log how long it took for debugging, maybe retry.
By default it builds a Future[Try[A]] from Future[A]. When default value is provided it builds Future[A] from Future[A]. At the very minimum it'll apply a mandatory timeout but you can add retry logic, call tracer, etc.
It is important to specify type A _at_the_time_of_creation_, type inference doesn't pick it up.
We want to apply timeouts to *all* Futures, so,
...futureBuilder.runWithTimeout(100 milliseconds){ .... something that returns Future ... }