use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForBranchOperation.
@Test
@SuppressWarnings({ "unchecked", "deprecation" })
public void shouldUseSpecifiedNameForBranchOperation() {
builder.stream(STREAM_TOPIC).branch(Named.as("branch-processor"), (k, v) -> true, (k, v) -> false);
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "branch-processor", "branch-processor-predicate-0", "branch-processor-predicate-1");
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseSpecifiedNameForMergeOperation.
@Test
public void shouldUseSpecifiedNameForMergeOperation() {
final String topic1 = "topic-1";
final String topic2 = "topic-2";
final KStream<String, String> source1 = builder.stream(topic1);
final KStream<String, String> source2 = builder.stream(topic2);
source1.merge(source2, Named.as("merge-processor"));
builder.build();
final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).buildTopology();
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", "merge-processor");
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project kafka by apache.
the class StreamsBuilderTest method shouldUseGeneratedStoreNamesForLeftJoinOperationBetweenKStreamAndKStream.
@Test
public void shouldUseGeneratedStoreNamesForLeftJoinOperationBetweenKStreamAndKStream() {
final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC);
final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO);
streamOne.leftJoin(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-JOINTHIS-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 + "-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 shouldUseSpecifiedNameForLeftJoinOperationBetweenKStreamAndKStream.
@Test
public void shouldUseSpecifiedNameForLeftJoinOperationBetweenKStreamAndKStream() {
final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC);
final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO);
streamOne.leftJoin(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 + "-this-join-store", STREAM_OPERATION_NAME + "-outer-other-join-store", STREAM_OPERATION_NAME + "-left-shared-join-store");
assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", STREAM_OPERATION_NAME + "-this-windowed", STREAM_OPERATION_NAME + "-other-windowed", STREAM_OPERATION_NAME + "-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 shouldUseSpecifiedNameForMapValuesOperation.
@Test
public void shouldUseSpecifiedNameForMapValuesOperation() {
builder.stream(STREAM_TOPIC).mapValues(v -> 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