akka/akka-core

concatSubstreams hangs when used as documented.

開放

#25,814 建立於 2018年10月19日

 (14 則留言) (0 個反應) (0 位負責人)Scala (3,547 個分叉)batch import
1 - triagedhackathonhelp wantedt:docst:stream

倉庫指標

星標
 (13,277 顆星)
PR 合併指標
 (平均合併 8天 19小時) (30 天內合併 10 個 PR)

描述

I'm trying to use concatSubstreams to collapse the results of a groupBy in order (as I can do with rxjava/reactor etc). But when I try this with akka, it hangs after outputting the first element. The docs do indicate it could hang if the number of groupBy streams were insufficient, but the docs also include an example, which I expected to work.

The docs reference this code in the test suite.. https://github.com/akka/akka/blob/v2.5.17/akka-docs/src/test/java/jdocs/stream/SubstreamDocTest.java#L67-L70

Here's that example from the docs/test case slightly modified to run standalone (added println sink)

final ActorSystem system = ActorSystem.create("QuickStart");
final Materializer mat = ActorMaterializer.create(system);
Source.from(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
  .groupBy(3, elem -> elem % 3)
  .concatSubstreams()
  .runWith(Sink.foreach(a -> System.out.println(a)), mat);

When this runs I would expect to see

1
4
7
10
2
5
8
3
6
9

But instead I just see 1 then it hangs.

Are the docs incorrect? are groupBy/concatSubstreams defective? or am I missing something obvious as to why it isn't running?

貢獻者指南