Questions tagged [spring-kafka-test]
134 questions
0
votes
2 answers
JUnit tests With Spring Boot 2.1.12 and Spring for Apache Kafka 2.2.12
Just trying to find out a simple example with Spring Boot 2.1.12 and Spring for Apache Kafka 2.2.12 that works with a KafkaListener, to retry last failed message. If a message fails, the message should be redirected to another Topic where the…

Lucas Lopes
- 1
- 1
- 3
0
votes
0 answers
spring kafka embedded broker - My actual listener is never trigerred
I'm using Kafka embedded broker with spring boot and junit 5.I have been able to wire up successfully and see that the embedded broker is running.
In my setup method I pump in a few messages to the queue that my actual code listens on
…

Chetya
- 1,267
- 1
- 17
- 31
0
votes
0 answers
Unknown test classMethod execute while deploying code in gitlab
I am trying to deploy my code in gitlab.
It has a unit test class to test my Kafka producer.
It runs properly in local. But when I try to build it in gitlab it gets failed because of a test.
com.project.kafka.KafkaUtilTest > classMethod…

Shamil Puthukkot
- 442
- 2
- 17
0
votes
1 answer
Find number of messages in a Kafka topic using Java
I am using Kafka Utils to test a certain kafka based messaging system. I want to find out the number of messages in a particular topic without using kafka-console-consumer.sh script. I can't seem to find a KafkaTestUtils based way or any way in java…

Kunal gupta
- 481
- 2
- 7
- 19
0
votes
1 answer
Spring Kafka (2.2.7.RELEASE) with. kafka-clients:2.2.1 IOException during embedded broker startup
Driven by a dependency-check warning we tried to bump the version of org.apache.kafka:kafka-clients to version 2.2.1 in our setup, using spring-kafka:2.2.7.
As a result the tests using EmbeddedKafkaRule fail during broker startup with an IOException…

Markward Schubert
- 141
- 1
- 1
- 12
0
votes
1 answer
Unit testing MessageListener class
How do you unit test a class that implements the spring-kafka MessageListener interface? I have a listener class that I am manually listening to topics with a onMessage function. This function is very simple and just receives the messages.
My setup…

Clev_James23
- 171
- 1
- 3
- 15
0
votes
1 answer
Embedded Spring Kafka attempting to start Runtime Kafka
I have a Spring Kafka project, and I have written some unit tests for it.
When I execute the test classes, the project attempts to use the actual Kafka broker, and not the embedded Kafka broker as annotated in my test…

Mohammad Najar
- 2,009
- 2
- 21
- 31
0
votes
1 answer
SpringBootTest fail if application contains @KafkaListener annotation
I create a new spring boot project with a simple test:
@RunWith(SpringRunner.class)
@SpringBootTest
public class ExampleApplicationTests {
@Test
public void contextLoads() {
}
}
When I run this test it succeeds. But If I add any…

ip696
- 6,574
- 12
- 65
- 128
0
votes
1 answer
How to trigger and handle these Spring Kafka events
In my Spring Boot project where I have a number of Spring Kafka consumers, I have added a number of event listeners to monitor the health of these consumers. Here is the code:
@Component
public class ApplicationContextListeningService {
…

Hua
- 666
- 2
- 9
- 21
0
votes
1 answer
Spring Kafka @SendTo Not Sending Headers
I'm sending a message to Kafka using the ReplyingKafkaTemplate and it's sending the message with a kafka_correlationId. However, when it hits my @KafkaListener method and forwards it to a reply topic, the headers are lost.
How do I preserve the…

George
- 2,820
- 4
- 29
- 56
0
votes
1 answer
Update spring-kafka-test to 2.2.x but still use old kafka-client 1.1.1 with junit5 and spring boot 2
I am currently using spring boot 2 and junit 5. I want to make use of spring-kafka-test for testing, however the version of spring-kafka that I use is 2.1.8.RELEASE. With this I believe its not possible to use EmbeddedKafkaBroker since that is…

cheddarDev
- 232
- 1
- 7
- 22
-1
votes
0 answers
Testcase for embeddedKafka to verify if kafka messages are produced, processed and consumed properly
I am looking for the testng testcase using embeeded kafka to verify if message are produced, processed and consumed properly.
I am also looking for code to mick the dependencies and test the event driven microservices in test environment.
I have…
-1
votes
1 answer
Minimun supported JAVA version with kafka-client 3.4.0
We are trying to upgarde kafka-client from 2.8.2 to 3.4.0 with JAVA 11.
But while building the application its failing.
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.543 sec <<<…
-2
votes
1 answer
Test kafka based backend application using the Confluent platform?
how the functional testcases are written for backend applications which is based on pub-sub model?
Any example please?
I tried using confluent platform to test kafka producer & consumers but I wasn’t able to configure topic in confluent.