Execute Kafka streams and pass a block of code that can operate while the streams are active.
Execute Kafka streams and pass a block of code that can
operate while the streams are active.
The code block can be used for publishing and consuming messages in Kafka.
The block gets a pre-initialized kafka consumer that can be used implicitly for
util methods such as consumeLazily(String)
.
e.g.
runStreams(Seq("inputTopic", "outputTopic", topology) { // here you can publish and consume messages and make assertions publishToKafka(in, Seq("one-string", "another-string")) consumeFirstStringMessageFrom(in) should be ("one-string") }
the topics that should be created in Kafka before launching the streams.
the streams topology that will be used to instantiate the streams with a default configuration (all state directories are different and in temp folders)
additional KafkaStreams configuration (overwrite existing keys in default config)
the code block that will executed while the streams are active. Once the block has been executed the streams will be closed.
Create a test stream config for a given stream.
Create a test stream config for a given stream.
the name of the stream. It will be used as the Application ID
any additional configuration. If the keys are already defined in the default they will be overwritten with this
the Kafka test configuration
the Streams configuration
Helper trait for testing Kafka Streams. It creates an embedded Kafka Instance for each test case. Use
runStreams
to execute your streams.