akka/akka-core

concatSubstreams hangs when used as documented.

オープン

#25,814 opened on 2018/10/19

 (14 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (3,547 件のフォーク)batch import
1 - triagedhackathonhelp wantedt:docst:stream

Repository metrics

Stars
 (13,277 個のスター)
PR merge metrics
 (平均マージ 8d 19h) (30d で 10 merged PRs)

説明

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?

コントリビューターガイド