Search in sources :

Example 1 with RocksDBWindowStoreSupplier

use of org.apache.kafka.streams.state.internals.RocksDBWindowStoreSupplier in project kafka by apache.

the class TopologyBuilderTest method shouldAddInternalTopicConfigWithCompactAndDeleteSetForWindowStores.

@SuppressWarnings("unchecked")
@Test
public void shouldAddInternalTopicConfigWithCompactAndDeleteSetForWindowStores() throws Exception {
    final TopologyBuilder builder = new TopologyBuilder();
    builder.setApplicationId("appId");
    builder.addSource("source", "topic");
    builder.addProcessor("processor", new MockProcessorSupplier(), "source");
    builder.addStateStore(new RocksDBWindowStoreSupplier("store", 30000, 3, false, null, null, 10000, true, Collections.<String, String>emptyMap(), false), "processor");
    final Map<Integer, TopicsInfo> topicGroups = builder.topicGroups();
    final TopicsInfo topicsInfo = topicGroups.values().iterator().next();
    final InternalTopicConfig topicConfig = topicsInfo.stateChangelogTopics.get("appId-store-changelog");
    final Properties properties = topicConfig.toProperties(0);
    final List<String> policies = Arrays.asList(properties.getProperty(InternalTopicManager.CLEANUP_POLICY_PROP).split(","));
    assertEquals("appId-store-changelog", topicConfig.name());
    assertTrue(policies.contains("compact"));
    assertTrue(policies.contains("delete"));
    assertEquals(2, policies.size());
    assertEquals("30000", properties.getProperty(InternalTopicManager.RETENTION_MS));
    assertEquals(2, properties.size());
}
Also used : MockProcessorSupplier(org.apache.kafka.test.MockProcessorSupplier) InternalTopicConfig(org.apache.kafka.streams.processor.internals.InternalTopicConfig) TopicsInfo(org.apache.kafka.streams.processor.TopologyBuilder.TopicsInfo) Properties(java.util.Properties) RocksDBWindowStoreSupplier(org.apache.kafka.streams.state.internals.RocksDBWindowStoreSupplier) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)1 TopicsInfo (org.apache.kafka.streams.processor.TopologyBuilder.TopicsInfo)1 InternalTopicConfig (org.apache.kafka.streams.processor.internals.InternalTopicConfig)1 RocksDBWindowStoreSupplier (org.apache.kafka.streams.state.internals.RocksDBWindowStoreSupplier)1 MockProcessorSupplier (org.apache.kafka.test.MockProcessorSupplier)1 Test (org.junit.Test)1