org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster Java Examples
The following examples show how to use
org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppEmbeddedTest.java From Kafka-Streams-Real-time-Stream-Processing with The Unlicense | 5 votes |
@BeforeAll static void setUp() throws InterruptedException, IOException { //Start Kafka Cluster kafkaCluster = new EmbeddedKafkaCluster(NUM_BROKERS); kafkaCluster.start(); //Create topics kafkaCluster.createTopic(AppConfigs.impressionTopic); kafkaCluster.createTopic(AppConfigs.clicksTopic); kafkaCluster.createTopic(AppConfigs.outputTopic); //Create and start Streams application Properties properties = new Properties(); properties.put(StreamsConfig.APPLICATION_ID_CONFIG, AppConfigs.applicationID); properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaCluster.bootstrapServers()); properties.put(StreamsConfig.STATE_DIR_CONFIG, AppConfigs.stateStoreLocationUT); StreamsBuilder builder = new StreamsBuilder(); AppTopology.withBuilder(builder); Topology topology = builder.build(); streams = new KafkaStreams(topology, properties); streams.start(); }