use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForOuterJoinOperationBetweenKStreamAndKStream.
@Test
public void shouldUseSpecifiedNameForOuterJoinOperationBetweenKStreamAndKStream() {
final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC);
final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO);
streamOne.outerJoin(streamTwo, (value1, value2) -> value1, JoinWindows.ofTimeDifferenceWithNoGrace(Duration.ofHours(1)), StreamJoined.<String, String, String>as(STREAM_OPERATION_NAME).withName(STREAM_OPERATION_NAME));
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForStateStore(topology.stateStores(), STREAM_OPERATION_NAME + "-outer-this-join-store", STREAM_OPERATION_NAME + "-outer-other-join-store", STREAM_OPERATION_NAME + "-outer-shared-join-store");
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", STREAM_OPERATION_NAME + "-this-windowed", STREAM_OPERATION_NAME + "-other-windowed", STREAM_OPERATION_NAME + "-outer-this-join", STREAM_OPERATION_NAME + "-outer-other-join", STREAM_OPERATION_NAME + "-merge");
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForMapOperation.
@Test
public void shouldUseSpecifiedNameForMapOperation() {
builder.stream(STREAM_TOPIC).map(KeyValue::pair, Named.as(STREAM_OPERATION_NAME));
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", STREAM_OPERATION_NAME);
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForGlobalStoreProcessor.
@Test
public void shouldUseSpecifiedNameForGlobalStoreProcessor() {
builder.addGlobalStore(Stores.keyValueStoreBuilder(Stores.inMemoryKeyValueStore("store"), Serdes.String(), Serdes.String()), "topic", Consumed.with(Serdes.String(), Serdes.String()).withName("test"), new MockApiProcessorSupplier<>());
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildGlobalStateTopology();
assertNamesForOperation(topology, "test-source", "test");
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseGeneratedStoreNamesForOuterJoinOperationBetweenKStreamAndKStream.
@Test
public void shouldUseGeneratedStoreNamesForOuterJoinOperationBetweenKStreamAndKStream() {
final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC);
final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO);
streamOne.outerJoin(streamTwo, (value1, value2) -> value1, JoinWindows.ofTimeDifferenceWithNoGrace(Duration.ofHours(1)), StreamJoined.with(Serdes.String(), Serdes.String(), Serdes.String()).withName(STREAM_OPERATION_NAME));
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForStateStore(topology.stateStores(), "KSTREAM-OUTERTHIS-0000000004-store", "KSTREAM-OUTEROTHER-0000000005-store", "KSTREAM-OUTERSHARED-0000000004-store");
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", STREAM_OPERATION_NAME + "-this-windowed", STREAM_OPERATION_NAME + "-other-windowed", STREAM_OPERATION_NAME + "-outer-this-join", STREAM_OPERATION_NAME + "-outer-other-join", STREAM_OPERATION_NAME + "-merge");
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForForEachOperation.
@Test
public void shouldUseSpecifiedNameForForEachOperation() {
builder.stream(STREAM_TOPIC).foreach((k, v) -> {
}, Named.as(STREAM_OPERATION_NAME));
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", STREAM_OPERATION_NAME);
}
Aggregations