Questions tagged [spring-kafka-test]
134 questions
0
votes
1 answer
Spring Boot KafkaTemplate and KafkaListener test with EmbeddedKafka fails
I have 2 Spring Boot apps, one is Kafka publisher and the other is consumer. I am trying to write an integration test to make sure that events are sent and received.
The test is green when run in IDE or from command line without other tests, like…

Aleksei
- 137
- 1
- 12
0
votes
1 answer
Spring KafkaTestUtils: wait until message in topic would be consumed
So, i faced interesting situation:
In my integration test i send data to 2 topics, and they should be consumed by application by the order. At first - userTopic, then shoud be consumed userOrderTopic.
When i send my messages in test, it sends really…
user17492046
0
votes
1 answer
Upgrading to Spring boot to 2.5.5 creates issue with kafka libraries
I have upgraded spring boot version from 2.5.3 to 2.5.5 which has upgraded this libraries.
spring-kafka : from 2.7.4 to 2.7.7
spring-kafka-test : from 2.7.4 to 2.7.7
kafka-clients : from 2.7.1 to 2.8.1
spring-test : from…

usr_11
- 548
- 10
- 31
0
votes
1 answer
ClassNotFoundException: scala.collection.convert.AsJavaExtensions when using @EmbeddedKafka from spring-kafka-test
When trying to use @EmbeddedKafka from spring-kafka-test, I end up with ClassNotFoundException: scala.collection.convert.AsJavaExtensions (full stack trace here) when running the test.
I've tried a different Kafka version…

Tobias Hermann
- 9,936
- 6
- 61
- 134
0
votes
1 answer
How do I spin up an embedded kafka cluster during my test?
To test how our spring boot application handles it when the kafka cluster is not yet up, I would like to spin up an embedded kafka cluster in a junit test some time after the application starts up. How could I approach this?
As I understand it…

TinekeW
- 3
- 2
0
votes
1 answer
Null point exception on embedded Kafka
I am using embedded Kafka for unit testing a spring boot application. I am using the code -…

perplexedDev
- 857
- 4
- 17
- 49
0
votes
0 answers
Deserilaisation exception Spring Kafka | Corrupt message gets logged everytime server is restarted with ErrorDeserialiser
I have followed the below documentation https://www.confluent.io/blog/spring-kafka-can-your-kafka-consumers-handle-a-poison-pill/ to handle deserialization exceptions.
It works fine, the message gets logged and move forward, but everytime I restart…

Shreya Garg
- 51
- 7
0
votes
1 answer
Cannot subscribe multiple consumers to Spring Kafka Test embedded Kafka broker
I tried to subscribe two consumers to one EmbeddedKafkaBroker. The first one succeed, but the second failed. Both @EmbeddedKafka and @ClassRule brokers failed.
@RunWith(SpringRunner.class)
@SpringBootTest
@EmbeddedKafka(topics = { "topic" })
public…

yraydhitya
- 11
- 2
0
votes
2 answers
Missing dependency on EmbeddedKafka on integration test with groovy and spock
I've been trying to create an integration test using the embeddedKafka, but I'm getting problem of missing dependency when trying to run it, this is the error:
Unable to load class org.springframework.kafka.test.EmbeddedKafkaBroker due to missing…

Pedro Henrique
- 609
- 2
- 9
- 26
0
votes
1 answer
Why ${spring.embedded.kafka.brokers} not populated in application-test.yaml although i see the spring.embedded.kafka.brokers existing?
We're using @EmbeddedKafka, and in application-test.yml we have
kafka:
confluentBootstrapAddress: ${spring.embedded.kafka.brokers}
I can see that confluentBootstrapAddress is null.
However, if in debug mode i check…

NicuMarasoiu
- 776
- 9
- 25
0
votes
1 answer
How to test Kafka OnFailure callback with Junit?
I have the following code to send data to Kafka:
@Service
public class KafkaSender{
@Autowired
private KafkaTemplate kafkaTemplate;
public void sendMessage(Employee employee) {
ObjectMapper objectMapper = new…

hello world
- 171
- 3
- 13
0
votes
1 answer
Integration tests for spring kafka producer and consumer
I want to write tests for spring kafka producer and consumer. I have tried multiple ways:
EmbeddedKafka annotation
EmbeddedKafkaRule
EmbeddedKafkaBroker
etc...
Every time I get one or the other error and all the examples posted on GitHub don't…

user15262796
- 1
- 1
- 1
0
votes
1 answer
Embedded Kafka test cases are error after adding jsonschema2pojo-core
I have an application that created with Spring boot and Spring kafka libraries. Now I added jsonschema2pojo-core library to my pom file. After adding this jar file my test cases are failing with below error
Caused by:…

VKR
- 195
- 4
- 18
0
votes
1 answer
How to test Spring Kafka Streams
I wrote this stream apps using this approach:
a StreamConfigs class:
@Configuration
@EnableKafka
public class StreamConfigs {
@Value(...)
private String applicationId;
@Value(...)
private String bootstrapServer;
@Bean
public…

Vin
- 701
- 1
- 9
- 30
0
votes
1 answer
Unit test with EmbeddedKafka
I'm trying to setup a class for unit test using Springboot and EmbeddedKafka.
I have two topics, topicA and topicB, and I would to test message production into topicA and topicB.
So this is my class:
@EmbeddedKafka()
@SpringBootTest
…

Vin
- 701
- 1
- 9
- 30