Hi,
I am using Akka stream (in Java) with an external service which its methods takes time.
I don’t want this methods to block so I defined a flow which uses mapAsyncUnordered as follows:
Flow.of(SomeClass.class).mapAsyncUnordered(numThreads, someService::someMethod);
I want to define a timeout to the method running in the mapAsyncUnordered stage, so that if the method takes too much time, it won’t fill the mapAsyncUnordered queue and prevent from others to pass.
The only option I saw is to define a different actor and use “ask” method of it, but as described in the documentation, if we arrive to timeout, the whole stream will be terminated with failure and this is not good for me (although it can be recovered, since I can’t lose data).
https://doc.akka.io/docs/akka/current/stream/futures-interop.html
Is there another option?
Thank you!
2 posts - 2 participants