> If your current implementation is Future-based, then this sounds like a
job for Future.recoverWith: try defining a Future-returning function that
recursively calls itself in Future.recoverWith.

You can use the approach from https://gist.github.com/viktorklang/9414163
which works well. There is also a small library [1] for retry which you can
look into.

Chetan Mehrotra
[1] https://github.com/softwaremill/retry


On Mon, Nov 5, 2018 at 9:29 PM Brian Maso <br...@hashtracking.com> wrote:

> I'm sure there are a tons of ways of doing exponential back-off. If your
> current implementation is Future-based, then this sounds like a job for
> Future.recoverWith: try defining a Future-returning function that
> recursively calls itself in Future.recoverWith.
>
> And if you are using Akka Streams for streaming data from multiple HTTPs
> calls as a Source, then I would recommend a slurry of Source.unfoldAsync
> and Source.recoverWithRetries (or equivalent/related Akka Streams
> functionality).
>
> I imagine using Akka's supervisor strategy might work as well, but it
> feels not very functional to me... Sounds like trying to employ
> side-effects where good old functional composition describes the solution
> much better.
>
> Brian Maso
>
> On Mon, Nov 5, 2018 at 1:40 AM mandeep gandhi <welcomemand...@gmail.com>
> wrote:
>
>> Hi all,
>>
>> My use case is that I want to make external calls from an actor( on
>> receiving a type of message). If the HTTP call fails, I want to retry
>> exponentially.  My current code uses scalaj.http to HTTP calls.
>>
>> How to achieve it?
>>
>> Can Akka's Backoff supervisor strategy be used for the same (or is it an
>> anti-pattern)?
>>
>>
>> Thanks,
>> Mandeep Gandhi
>>
>> --
>>
>> *****************************************************************************************************
>> ** New discussion forum: https://discuss.akka.io/ replacing akka-user
>> google-group soon.
>> ** This group will soon be put into read-only mode, and replaced by
>> discuss.akka.io
>> ** More details:
>> https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
>>
>> *****************************************************************************************************
>> >>>>>>>>>>
>> >>>>>>>>>> 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.
>>
> --
>
> *****************************************************************************************************
> ** New discussion forum: https://discuss.akka.io/ replacing akka-user
> google-group soon.
> ** This group will soon be put into read-only mode, and replaced by
> discuss.akka.io
> ** More details:
> https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
>
> *****************************************************************************************************
> >>>>>>>>>>
> >>>>>>>>>> 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.
>

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      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