Hey everybody,
I'm trying to convince myself that a flow I'm building with Akka Streams is
deadlock-free. Here's what I'm trying to do:
- I have an infinite source *s* of some kind of requests *r1, r2, ... *that
I
need "execute".
- In case such an execution fails, I'd like to wait a bit (1s, say) and
try again.
- If a request cannot be executed for 10 times, it will be dropped.
To keep resource consumption bounded, I thought I'd limit the number of
requests (to 100, say). So when there are around 100 requests in the
pipeline, the pipeline should not ask the source *s* for new elements but
just continue retrying until we have again only 99 or fewer requests.
I implemented this pseudo code:
s ~> PreferredMerge ~> Delay ~> buffer(100) ~> ExecuteRequest ~>
Broadcast ~> Report
PreferredMerge.pref() <~ RetriedOnceMore <~ FilterFail <~
Broadcast
Here, the source *s* emits Retry(request, retryCount) objects. These enter
a PreferredMerge stage on the un-preferred port, get delayed (using a
mapAsync) and then buffered. ExecuteRequest executes the request. The
result of this goes to a broadcast, one of whose outputs emits results
(succeeded or failed). In FilterFail, requests that failed for less than 10
times are kept and get their retryCount incremented in RetriedOnceMore before
they enter the PreferredMerge stage on the preferred port.
This works. But could it deadlock?
– Kaspar
--
>>>>>>>>>> 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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.