Hey,
I'm currently trying to execute HTTP requests in batches and then do a
Sink.fold over the results. This does not seem to work. What instead
happens is that I get 5 (the number I've set max-connections to at the
moment) "callback success" log entries and then nothing other than
five "Cancelling
akka.stream.impl.MultiStreamOutputProcessor$SubstreamOutput" messages.
What do I need to tell akka-streams to continue with the requests?
Sample code below:
Future<ArrayList<UserObject>> foldedFuture =
Source.from(Lists.newArrayList(currentBatch.getQueue().stream().map((req) -> {
HttpRequest postRequest =
HttpRequest.POST(req.callback.url).withEntity(MediaTypes.APPLICATION_JSON.toContentType(),
...);
Tuple2<HttpRequest, UserObject> t2 = Pair.create(postRequest,
req).toScala();
return t2;
}).iterator()))
.via(poolClientFlow)
.runFold(new ArrayList<UserObject>(), (list, t2) -> {
if (t2._1().isFailure() || t2._1().get().status().isFailure()) {
log.error("error cause: " + t2._1().failed().get());
callbackErrorCounter.increment();
list.add(t2._2());
} else {
log.error("callback success");
callbackCompletedCounter.increment();
}
return list;
}, materializer);
Thanks.
--
>>>>>>>>>> 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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.