Questions tagged [spring-kafka-test]

134 questions
2
votes
1 answer

spring embedded kafka with junit5 - No resolvable bootstrap urls given in bootstrap servers

I'm trying to use Embedded kafka for my tests.I'm using spring boot and junit5 as follows @SpringBootTest @EmbeddedKafka public class MyTest { //Instead of the class rule approach I'm using EmbeddedKafkaBroker embeddedKafka = new…
Chetya
  • 1,267
  • 1
  • 17
  • 31
2
votes
1 answer

How to Create Integration Test for Spring Kafka Listener

I have one MicroService who sends to another microservice message that should consume. So, the kafka configs works, and everything works, but I need to create one intregration test for this code, and I have no idea how. My KafkaConsumer.Class…
João Mazagão
  • 94
  • 2
  • 11
2
votes
1 answer

How to unit test Spring Cloud Stream with Kafka Streams

I've been trying to get Spring Cloud Stream to work with Kafka Streams for a while now, my project uses embedded kafka for testing with Kafka DSL and I used this repository as a base for my test implementation (it itself is a test cases for this…
2
votes
1 answer

Spring Embedded Kafka using Kafka 2.2.x

The Embedded Kafka Broker for Spring does not work when upgrading Spring-Kafka 2.2.x which is required for kafka-client and kafka-stream 2.2.3. It seems to require a meta.properties file in the log.dir directory, and requires setting a broker.id.…
2
votes
1 answer

What is the proper way of doing @DirtiesConfig when used @EmbeddedKafka

We have a "little" problem in our project with: "Connection to node 0 could not be established. Broker may not be available." Tests runs very very long time, and this message is logged at least once every second. But I found out, how to get rid of…
Martin Mucha
  • 2,385
  • 1
  • 29
  • 49
2
votes
0 answers

Spring Boot Kafka - consumer custom JsonDeserializer with type info in yaml/properties, without @Bean

Is it possible to pass type info to the deserializer of Kafka consumer without defining a @Configuration class with @Bean of consumerFactory() and containerFactory? In the @Bean method I have to put all configs I already have in yml file again into…
WesternGun
  • 11,303
  • 6
  • 88
  • 157
2
votes
1 answer

Can't use a @KafkaListener more than once in a Test

We are trying to test a cloud-stream-kafka application, and in the test we have multiple test methods sending messages, and a single @KafkaListener waiting for the response. However, the first test tends to pass, and the second test tends to…
2
votes
2 answers

How to set port in KafkaEmbedded when unit testing spring-kafka consumer

I am using spring-boot-starter-parent version 1.5.0.RELEASE, spring-kafka version 1.0.0.RELEASE and spring-kafka-test version 1.0.0.RELEASE in an application which consumes messages from a Kakfa 0.9 cluster. I have a unit test for my consumer which…
AlphaEpsilon
  • 141
  • 3
  • 11
2
votes
1 answer

spring Kafka integration testing with embedded Kafka

I have spring boot application that had a consumer consumes from topic in one cluster and produces to another topic in different cluster. Now I'm trying to write integration test case using spring embedded Kafka but having an issue KafkaTemplate…
app
  • 733
  • 5
  • 15
  • 27
1
vote
1 answer

transaction-id-prefix need to be identical for same application instance in spring kafka 3?

I understand in spring kafka 3, I need a unique transaction-id-prefix for applications running with multiple instances. here is my configuration: fun getTxnIdPrefix() { return "$hostname-mytransaction-id-prefix-${UUID.randomUUID()}" } in this…
1
vote
1 answer

Test Exception thrown by Kafka Consumer in Spring Boot

I've the following configuration server: port: 8001 spring: kafka: bootstrap-servers: localhost:9092 consumer: auto-offset-reset: latest group-id: group-id value-deserializer:…
Smaillns
  • 2,540
  • 1
  • 28
  • 40
1
vote
2 answers

EmbeddedKafka failed authentication due to: Unexpected handshake request with client mechanism PLAIN, enabled mechanisms are []

I wrote a simple test using EmbeddedKafkaBroker, I created a test producer and sent a message, but my KafkaListener doesn’t get triggered, so the test fails every time. Is there a way to test my Kafka consumer so I can ensure the test code coverage?…
1
vote
1 answer

KafkaMessageChannelBinder cannot be cast to class TestSupportBinder

In our project we are using the spring-cloud-starter-stream-kafka for consuming the messages from Kafka, after adding the @ComponentScan for "org.springframework.cloud.stream.binder.kafka" package, the integration tests started failing with the…
1
vote
2 answers

Delete topic using EmbeddedKafkaBroker

I wrote a test class in which I'would test topic deletion I found for EmbeddedKafkaBroker this method embeddedKafkaBroker.addTopics("new-topic"); that make me able to create a new topic, but I can't find anything to delete a topic. So, how can I…
Vin
  • 701
  • 1
  • 9
  • 30
1
vote
1 answer

How to send a message with specific offset to EmbeddedKafka in spring boot?

I am writing an integration test for an application that connects to Kafka to consume and publish data and for that purpose I am using EmbeddedKafka. Part of the logic is to consume messages with specific offsets. I want to simulate this, therefore…
1 2
3
8 9