use of org.apache.kafka.streams.kstream.CogroupedKStream in project kafka by apache.
the class CogroupedKStreamImplTest method shouldInsertRepartitionsTopicForCogroupsUsedTwice.
@Test
public void shouldInsertRepartitionsTopicForCogroupsUsedTwice() {
final StreamsBuilder builder = new StreamsBuilder();
final Properties properties = new Properties();
final KStream<String, String> stream1 = builder.stream("one", stringConsumed);
final KGroupedStream<String, String> groupedOne = stream1.map((k, v) -> new KeyValue<>(v, k)).groupByKey(Grouped.as("foo"));
final CogroupedKStream<String, String> one = groupedOne.cogroup(STRING_AGGREGATOR);
one.aggregate(STRING_INITIALIZER);
one.aggregate(STRING_INITIALIZER);
final String topologyDescription = builder.build(properties).describe().toString();
assertThat(topologyDescription, equalTo("Topologies:\n" + " Sub-topology: 0\n" + " Source: KSTREAM-SOURCE-0000000000 (topics: [one])\n" + " --> KSTREAM-MAP-0000000001\n" + " Processor: KSTREAM-MAP-0000000001 (stores: [])\n" + " --> foo-repartition-filter\n" + " <-- KSTREAM-SOURCE-0000000000\n" + " Processor: foo-repartition-filter (stores: [])\n" + " --> foo-repartition-sink\n" + " <-- KSTREAM-MAP-0000000001\n" + " Sink: foo-repartition-sink (topic: foo-repartition)\n" + " <-- foo-repartition-filter\n\n" + " Sub-topology: 1\n" + " Source: foo-repartition-source (topics: [foo-repartition])\n" + " --> COGROUPKSTREAM-AGGREGATE-0000000006, COGROUPKSTREAM-AGGREGATE-0000000012\n" + " Processor: COGROUPKSTREAM-AGGREGATE-0000000006 (stores: [COGROUPKSTREAM-AGGREGATE-STATE-STORE-0000000002])\n" + " --> COGROUPKSTREAM-MERGE-0000000007\n" + " <-- foo-repartition-source\n" + " Processor: COGROUPKSTREAM-AGGREGATE-0000000012 (stores: [COGROUPKSTREAM-AGGREGATE-STATE-STORE-0000000008])\n" + " --> COGROUPKSTREAM-MERGE-0000000013\n" + " <-- foo-repartition-source\n" + " Processor: COGROUPKSTREAM-MERGE-0000000007 (stores: [])\n" + " --> none\n" + " <-- COGROUPKSTREAM-AGGREGATE-0000000006\n" + " Processor: COGROUPKSTREAM-MERGE-0000000013 (stores: [])\n" + " --> none\n" + " <-- COGROUPKSTREAM-AGGREGATE-0000000012\n\n"));
}
Aggregations