Questions tagged [spring-kafka-test]

134 questions
0
votes
1 answer

Kafka exactly once messaging test with "consume-transform-produce" Integration test

I am writing testcase to test the my application's consume-transform-produce loop of the Kafka. So effectively I am consuming from a sourceTopic-processing-sendMessage to Destination topic. I am writing these testcases to prove the exactly once…
Gururaj Nayak
  • 636
  • 1
  • 9
  • 18
0
votes
1 answer

Spring boot tests not working with embedded kafka

I recently tried to cover my functionality with integration tests and embedded Kafka but ran into certain issues when I run them. The result is an exception which was been thrown by KafkaServer. This is the integration tests…
Scrobot
  • 1,911
  • 3
  • 19
  • 36
0
votes
1 answer

How to wrap a @KafkaListener which is handled by seekToCurrentErrorHandler with a latch for testing

I have a kafka listener which throws an exception and goes to seektocurrenterrorhandler for handling. I am trying to wrap the listener to add a latch and assert on it for my testing. But it seems to be not working. Can someone please…
0
votes
1 answer

Testing listener with @EmbeddedKafka from spring-kafka-test

I'm trying to test listener in springboot created using @KafkaListener But listener always listens on localhost:9092 instead of using this embededKafka My listener looks like this: @Component @Slf4j class SomeListener { private final…
Emiter
  • 268
  • 2
  • 13
0
votes
0 answers

Unit test for @KafkaListener - Null pointer exception

I have a Kafka consumer which is using an @KafkaListener annotation. To write the test cases using an embedded Kafka server, I followed the code here: How to write Unit test for @KafkaListener?. The suggested approach in the sample code is not…
Swapnil
  • 801
  • 3
  • 19
  • 42
0
votes
1 answer

integration test case for kafka

i am very new to junit test cases, i want to write junit for kafka integration. below is my code @EnableKafka @Configuration public class KafkaConfiguration { @Value("${bts_config}") private String bts_config; …
0
votes
1 answer

Errors: UnfinishedStubbing

I am writing Junit test case and I want to mock KafkaTemplate method kafkaTemplate.send(TOPIC_NAME, "someData");. In my project, I am using spring boot and Kafka. Below is the StudentRecords class. I am using mockito for mocking the…
user2587669
  • 532
  • 4
  • 10
  • 22
0
votes
1 answer

java.lang.ClassNotFoundException: org.apache.jute.OutputArchive with latest spring-kafka and spring-kafka-test 2.5.2

We have a spring boot app with spring-kafka and we are using embedded kafka for testing. We have upgraded Spring boot to 2.3.1 version and follow by latest spring kafka dependency which is 2.5.2. Now we are getting below error while executing…
0
votes
1 answer

How same consumers in same consumer group in multiple service instance work when using SeekToCurrentErrorHandler

I have tested my service having one instance using SeekToCurrentErrorHandler, which is having one consumer in one consumer group. In case of failure, retry happens and the records get committed as I have user ACK mode as RECORD and did not use ACK…
0
votes
1 answer

AggregatingReplyingKafkaTemplate releaseStrategy Question

There seem to be an issue when I use AggregatingReplyingKafkaTemplate with template.setReturnPartialOnTimeout(true) in that, it returns timeout exception even if partial results are available from consumers. In example below, I have 3 consumers to…
Murali S
  • 5
  • 2
0
votes
1 answer

Catching exception in Kafkalistener Integration test

So I need to create an integration test for my kafkalistener method, where the test expects ListenerExecutionFailedException is actually thrown because the message was failed during consumption due to another service being inactive. Below is the…
0
votes
1 answer

KStream to KTable Inner Join producing different number of records every time processed with same data

I want to do a KStream to KTable Join. using KTable as just a lookup table. below steps shows the sequence in which code is executed Construct KTable ReKey KTable Construct KStream ReKey KStream Join KStream - KTable Lets say there are 8000…
0
votes
0 answers

Eclipse issue: unit tests triggered when I debug but not when I run

Goal: I want to "unit" test kafka producer sending messages to a kafka hosted in a docker container. In other words, it must connect to external kafka other than the common used for unit test named Embedded Kafka. I can successfully reach my kafka…
Jim C
  • 3,957
  • 25
  • 85
  • 162
0
votes
1 answer

Kafka Topic Unit Testing

I'm creating topic in Kafka with the below method, public class KafkaTopicAdmin { public void createTopic(final String topicName) { final AdminClient client = getKafkaClient(); final List topics =…
parrotjack
  • 432
  • 1
  • 6
  • 18
0
votes
2 answers

Spring Kafka Unit Tests Triggers the listener, but the method cannot get the message using consumer.poll

We are using spring-kafka-test-2.2.8-RELEASE. When I use the template to send the message, it triggers the listener correctly, but I can't get the message content in the consumer.poll. If i instantiate the KafkaTemplate without "wiring" it in a…
Lucas Lopes
  • 1
  • 1
  • 3
1 2 3
8
9