Reputation: 376
I'd like to test my processor with embedded kafka. Is it even possible?
When I run the app locally with Kafka & ZK then it works perfectly - my example listener receives the message same as processor (great, both listen to the same topic), but when I test it with embedded kafka then only method annotated with @KafkaListener
gets the message but processor doesn't get anything.
I would like to send message to the processor's topic, then check if it sent the result to the other topic.
Is there any solution for such usecase?
Upvotes: 0
Views: 2525
Reputation: 62360
It's recommended to test your code using TopologyTestDriver
: https://kafka.apache.org/11/documentation/streams/developer-guide/testing.html
You can also use KafkaEmbedded
, or maybe better EmbeddedKafkaCluster
. For examples, check out the Kafka Streams integration tests: https://github.com/apache/kafka/tree/trunk/streams/src/test/java/org/apache/kafka/streams/integration
Upvotes: 2