use of org.apache.kafka.streams.state.WindowBytesStoreSupplier in project kafka by apache.
the class KStreamKStreamJoinTest method shouldThrowExceptionOtherStoreSupplierWindowSizeDoesNotMatchJoinWindowsWindowSize.
@Test
public void shouldThrowExceptionOtherStoreSupplierWindowSizeDoesNotMatchJoinWindowsWindowSize() {
// Case where window size of otherJoinStore doesn't match JoinWindows
final WindowBytesStoreSupplier thisStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store", 150L, 100L, true);
final WindowBytesStoreSupplier otherStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store-other", 150L, 150L, true);
buildStreamsJoinThatShouldThrow(streamJoined.withThisStoreSupplier(thisStoreSupplier).withOtherStoreSupplier(otherStoreSupplier), joinWindows, errorMessagePrefix);
}
use of org.apache.kafka.streams.state.WindowBytesStoreSupplier in project kafka by apache.
the class KStreamKStreamJoinTest method shouldExceptionWhenJoinStoresDoNotHaveUniqueNames.
@Test
public void shouldExceptionWhenJoinStoresDoNotHaveUniqueNames() {
final JoinWindows joinWindows = JoinWindows.ofTimeDifferenceAndGrace(ofMillis(100L), Duration.ofMillis(50L));
final StreamJoined<String, Integer, Integer> streamJoined = StreamJoined.with(Serdes.String(), Serdes.Integer(), Serdes.Integer());
final WindowBytesStoreSupplier thisStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store", 150L, 100L, true);
final WindowBytesStoreSupplier otherStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store", 150L, 100L, true);
buildStreamsJoinThatShouldThrow(streamJoined.withThisStoreSupplier(thisStoreSupplier).withOtherStoreSupplier(otherStoreSupplier), joinWindows, "Both StoreSuppliers have the same name. StoreSuppliers must provide unique names");
}
use of org.apache.kafka.streams.state.WindowBytesStoreSupplier in project kafka by apache.
the class KStreamKStreamJoinTest method shouldThrowExceptionThisStoreSupplierRetentionDoNotMatchWindowsSizeAndGrace.
@Test
public void shouldThrowExceptionThisStoreSupplierRetentionDoNotMatchWindowsSizeAndGrace() {
// Case where retention of thisJoinStore doesn't match JoinWindows
final WindowBytesStoreSupplier thisStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store", 500L, 100L, true);
final WindowBytesStoreSupplier otherStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store-other", 150L, 100L, true);
buildStreamsJoinThatShouldThrow(streamJoined.withThisStoreSupplier(thisStoreSupplier).withOtherStoreSupplier(otherStoreSupplier), joinWindows, errorMessagePrefix);
}
use of org.apache.kafka.streams.state.WindowBytesStoreSupplier in project kafka by apache.
the class KStreamKStreamJoinTest method shouldThrowExceptionWhenThisJoinStoreSetsRetainDuplicatesFalse.
@Test
public void shouldThrowExceptionWhenThisJoinStoreSetsRetainDuplicatesFalse() {
// Case where thisJoinStore retain duplicates false
final WindowBytesStoreSupplier thisStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store", 150L, 100L, false);
final WindowBytesStoreSupplier otherStoreSupplier = buildWindowBytesStoreSupplier("in-memory-join-store-other", 150L, 100L, true);
buildStreamsJoinThatShouldThrow(streamJoined.withThisStoreSupplier(thisStoreSupplier).withOtherStoreSupplier(otherStoreSupplier), joinWindows, "The StoreSupplier must set retainDuplicates=true, found retainDuplicates=false");
}
use of org.apache.kafka.streams.state.WindowBytesStoreSupplier in project kafka by apache.
the class KStreamKStreamLeftJoinTest method testLeftJoinWithInMemoryCustomSuppliers.
@Test
public void testLeftJoinWithInMemoryCustomSuppliers() {
final JoinWindows joinWindows = JoinWindows.ofTimeDifferenceAndGrace(ofMillis(100L), ofMillis(0L));
final WindowBytesStoreSupplier thisStoreSupplier = Stores.inMemoryWindowStore("in-memory-join-store", Duration.ofMillis(joinWindows.size() + joinWindows.gracePeriodMs()), Duration.ofMillis(joinWindows.size()), true);
final WindowBytesStoreSupplier otherStoreSupplier = Stores.inMemoryWindowStore("in-memory-join-store-other", Duration.ofMillis(joinWindows.size() + joinWindows.gracePeriodMs()), Duration.ofMillis(joinWindows.size()), true);
final StreamJoined<Integer, String, String> streamJoined = StreamJoined.with(Serdes.Integer(), Serdes.String(), Serdes.String());
runLeftJoin(streamJoined.withThisStoreSupplier(thisStoreSupplier).withOtherStoreSupplier(otherStoreSupplier), joinWindows);
}
Aggregations