Fix snippet example in stream-rate doc #21006

Fix #section-buffer by replacing .withAttributes by .addAttributes to avoid overwriting the .async option.

* Update StreamBuffersRateDocTest.java

Fix #section-buffer by replacing .withAttributes by .addAttributes to avoid overwriting the .async option.
This commit is contained in:
Alexandre Tamborrino 2016-07-21 17:35:13 +02:00 committed by Johan Andrén
parent 210c11e85e
commit c8dfa2458d
2 changed files with 2 additions and 2 deletions

View file

@ -65,7 +65,7 @@ public class StreamBuffersRateDocTest extends AbstractJavaTest {
final Flow<Integer, Integer, NotUsed> flow1 = final Flow<Integer, Integer, NotUsed> flow1 =
Flow.of(Integer.class) Flow.of(Integer.class)
.map(elem -> elem * 2).async() .map(elem -> elem * 2).async()
.withAttributes(Attributes.inputBuffer(1, 1)); // the buffer size of this map is 1 .addAttributes(Attributes.inputBuffer(1, 1)); // the buffer size of this map is 1
final Flow<Integer, Integer, NotUsed> flow2 = final Flow<Integer, Integer, NotUsed> flow2 =
flow1.via( flow1.via(
Flow.of(Integer.class) Flow.of(Integer.class)

View file

@ -30,7 +30,7 @@ class StreamBuffersRateSpec extends AkkaSpec {
//#section-buffer //#section-buffer
val section = Flow[Int].map(_ * 2).async val section = Flow[Int].map(_ * 2).async
.withAttributes(Attributes.inputBuffer(initial = 1, max = 1)) // the buffer size of this map is 1 .addAttributes(Attributes.inputBuffer(initial = 1, max = 1)) // the buffer size of this map is 1
val flow = section.via(Flow[Int].map(_ / 2)).async // the buffer size of this map is the default val flow = section.via(Flow[Int].map(_ / 2)).async // the buffer size of this map is the default
//#section-buffer //#section-buffer
} }