Using Embedded Kafka for testing Kafka Streams application

Solution for Using Embedded Kafka for testing Kafka Streams application
is Given Below:

We are evaluating if we can use Embedded Kafka for testing our streams app. Can we achieve the below using embedded kafka:

  • Use KafkaTestUtils to produce the message to the input topic running on Embedded Kafka.
  • Expect the streams application to pick up the message for processing (should the application be running for this ?)
  • Use KafkaTestUtils to consume the processed message from output topic.
  • Assert the expected condition.

Please let me know.Thanks.

Yes; you can do that.

There are examples in the framework tests https://github.com/spring-projects/spring-kafka/tree/main/spring-kafka/src/test/java/org/springframework/kafka/streams