Questions tagged [spring-kafka-test]

134 questions
1
vote
2 answers

java.lang.ClassCastException: class model - Error in springboot kafka integration while sending JSON object as message in topic

I am new to Kafka and am facing the below issue for mymodel class User [Request processing failed; nested exception is org.apache.kafka.common.errors.SerializationException: Can't convert value of class model.User to class…
1
vote
0 answers

EmbeddedKafka Spring boot test fails only on Github actions but not locally

I am creating a demo application for Groovy using Spring boot with Kafka and elastic. I used @EmbeddedKafka annotation in my Spock tests and they are working really nice locally; both on Windows and Ubuntu. They work from within Intellij by just…
1
vote
2 answers

How to do integration testing of KStream topology using spring-boot EmbeddedKafka?

I have a simple spring-boot KStream topology that transforms a string from lowercase to uppercase. I want my integration test to launch an embedded kafka, and then test the topology. I would like to know if it possible to write integration tests…
tintin
  • 5,676
  • 15
  • 68
  • 97
1
vote
1 answer

Exception while testing Spring Kafka error handler for @KafkaListener

I am trying to test my error handler defined in the containerlistenerfactory which is being used by @KafkaListener. I have different retry counts based of different exception throw by the listener which i want to test is working correctly. But i am…
1
vote
0 answers

Kafka consumer is getting out of active group and not able to consume ant message further

I am using spring kafka to implement kafka listener with default properties. I have noticed that with some failure eg: broker not available or any internal call failure after consuming message, it stops consuming messages and I can see attached…
1
vote
1 answer

java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce at kafka.utils.TestUtils.tempDir(TestUtils.scala)

While using @EmbeddedKafka(topics = { "checkins" }) I am getting an error Caused by: java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce at kafka.utils.TestUtils.tempDir(TestUtils.scala) at…
1
vote
1 answer

Is it possible to connect to an old Kafka version (like 0.11) using new versions of spring-kafka like v2.5.4.RELEASE?

I constructed a spring boot application to produce data in a Kafka, but now I need to connect this application to an old Kafka (0.11v). I tried just changing the bootstrap-server, but I receive connection errors. I doubled checked if this Kafka…
1
vote
1 answer

ZooKeeperClientTimeoutException when using @EmbeddedKafka

Once I add @EmbeddedKafka to an integration test I see the following error: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedKafka': Invocation of init method failed; nested exception is…
Andras Hatvani
  • 4,346
  • 4
  • 29
  • 45
1
vote
1 answer

Spring kafka unit test listener not subscribing to topic

I have a sample project to explore spring with kafka ( find here ) . I have a listener subscribing to topic my-test-topic-upstream which will just lo the message and key and publish same to another topic my-test-topic-downstream. I tried this is…
1
vote
1 answer

How to set up Spring Kafka test using EmbeddedKafkaRule/ EmbeddedKafka to fix TopicExistsException Intermittent Error?

I have been having issues with testing my Kafka consumer and producer. The integration tests fail intermittently with TopicExistsException. This is how my current test class - UserEventListenerTest looks like for one of the…
1
vote
1 answer

Getting Exceptions during KafkaTest eventhough the test passes

I am running a Junit test using EmbeddedKafka,I am able to produce and consume to the embeddedKafka brokers, and successfully assert the data i have send. But i can see a lot of exceptions in the stack trace, which comes after the assertion is…
1
vote
2 answers

Embedded Kafka starting with wrong number of partitions

I have started an instance of EmbeddedKafka in a JUnit test. I can read the records that I have pushed to my stream correctly in my application, but one thing I have noticed is that I only have one partition per topic. Can anyone explain why? In my…
1
vote
1 answer

Unit Test KafkaMessageListenerContainer

Is it possible to unit test the KafkaMessageListenerContainer @Bean? I want to know if it is possible to conduct a put unit test on the code I use to construct the container. I'm trying to make sure that the container is getting built successfully.…
Collins21
  • 21
  • 3
1
vote
1 answer

How can you verify immediately that a message was acknowledged when integration testing using Embedded Kafka in Spring Cloud Stream?

We use Spring Cloud Stream Kafka Binder (with Project Reactor integration, i.e. Flux streams) and manual offset commits (i.e. autoCommitOffset = false). We are trying to write an integration test with Embedded Kafka from spring-kafka-test that's…
1
vote
0 answers

What is the proper @EmbeddedKafka usage for IntegrationTests?

I've read the spring-kafka documentation, examples I found, and half of stackoverflow, but I fail to understand, who @EmbeddedKafka should work. Especially for integration tests. @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment =…
Martin Mucha
  • 2,385
  • 1
  • 29
  • 49
1 2 3
8 9