19455 Simplify conflate signature for the common case
This commit is contained in:
parent
c36fdb111c
commit
3081e2895b
21 changed files with 281 additions and 55 deletions
|
|
@ -58,11 +58,11 @@ public class RecipeMissedTicks extends RecipeTest {
|
|||
@SuppressWarnings("unused")
|
||||
//#missed-ticks
|
||||
final Flow<Tick, Integer, NotUsed> missedTicks =
|
||||
Flow.of(Tick.class).conflate(tick -> 0, (missed, tick) -> missed + 1);
|
||||
Flow.of(Tick.class).conflateWithSeed(tick -> 0, (missed, tick) -> missed + 1);
|
||||
//#missed-ticks
|
||||
final TestLatch latch = new TestLatch(3, system);
|
||||
final Flow<Tick, Integer, NotUsed> realMissedTicks =
|
||||
Flow.of(Tick.class).conflate(tick -> 0, (missed, tick) -> { latch.countDown(); return missed + 1; });
|
||||
Flow.of(Tick.class).conflateWithSeed(tick -> 0, (missed, tick) -> { latch.countDown(); return missed + 1; });
|
||||
|
||||
Pair<TestPublisher.Probe<Tick>, TestSubscriber.Probe<Integer>> pubSub =
|
||||
tickStream.via(realMissedTicks).toMat(sink, Keep.both()).run(mat);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ public class RecipeSimpleDrop extends RecipeTest {
|
|||
@SuppressWarnings("unused")
|
||||
//#simple-drop
|
||||
final Flow<Message, Message, NotUsed> droppyStream =
|
||||
Flow.of(Message.class).conflate(i -> i, (lastMessage, newMessage) -> newMessage);
|
||||
Flow.of(Message.class).conflate((lastMessage, newMessage) -> newMessage);
|
||||
//#simple-drop
|
||||
final TestLatch latch = new TestLatch(2, system);
|
||||
final Flow<Message, Message, NotUsed> realDroppyStream =
|
||||
Flow.of(Message.class).conflate(i -> i, (lastMessage, newMessage) -> { latch.countDown(); return newMessage; });
|
||||
Flow.of(Message.class).conflate((lastMessage, newMessage) -> { latch.countDown(); return newMessage; });
|
||||
|
||||
final Pair<TestPublisher.Probe<Message>, TestSubscriber.Probe<Message>> pubSub = TestSource
|
||||
.<Message> probe(system)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue