Discussion:
[akka-user][deprecated] Akka backoff supervision for HTTP retries
mandeep gandhi
2018-11-05 09:40:20 UTC
Permalink
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+***@googlegroups.com.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Brian Maso
2018-11-05 15:58:53 UTC
Permalink
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
Post by mandeep gandhi
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Read the docs: http://akka.io/docs/
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
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
*****************************************************************************************************
Post by mandeep gandhi
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.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Chetan Mehrotra
2018-11-06 12:06:41 UTC
Permalink
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
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
Post by mandeep gandhi
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Read the docs: http://akka.io/docs/
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
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Post by mandeep gandhi
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
Post by mandeep gandhi
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
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
*****************************************************************************************************
Post by mandeep gandhi
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.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Brian Maso
2018-11-06 13:20:00 UTC
Permalink
Nice!
+1
Post by Chetan Mehrotra
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
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
Post by mandeep gandhi
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
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
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Post by mandeep gandhi
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
Post by mandeep gandhi
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
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Post by mandeep gandhi
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
Post by mandeep gandhi
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
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
*****************************************************************************************************
Post by Chetan Mehrotra
Post by mandeep gandhi
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.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Tim Moore
2018-11-07 04:54:57 UTC
Permalink
This is also built into Akka:
https://doc.akka.io/api/akka/current/akka/pattern/RetrySupport.html
Post by Chetan Mehrotra
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
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
Post by mandeep gandhi
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
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
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Post by mandeep gandhi
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
Post by mandeep gandhi
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
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
https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Post by mandeep gandhi
Read the docs: http://akka.io/docs/
http://doc.akka.io/docs/akka/current/additional/faq.html
Post by mandeep gandhi
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
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
--
Tim Moore
*Sr. Manager Engineering and Product Management, **Lightbend, Inc.*
***@lightbend.com
+61 420 981 589
--
*****************************************************************************************************
** 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
*****************************************************************************************************
Post by Chetan Mehrotra
Post by mandeep gandhi
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.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
mandeep gandhi
2018-11-12 05:14:08 UTC
Permalink
Gentle reminder.
Post by mandeep gandhi
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
*****************************************************************************************************
Post by mandeep gandhi
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.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Loading...