Questions tagged [spring-kafka-test]
134 questions
1
vote
1 answer
Spring-kafka-test testing JSON message with custom deserialization
I've mostly successfully set up a test using EmbeddedKafka, which produces and consumes one message. Below is a working version of the test:
@RunWith(SpringRunner.class)
@SpringBootTest
@EmbeddedKafka
public class KafkaFlowTest {
@Autowired
…

michauwilliam
- 814
- 1
- 11
- 22
1
vote
1 answer
How can I test method with @KafkaListener annotation in spring-boot application?
I have a spring component with @KafkaListener method:
@Slf4j
@Component
public class ResponseHandler {
private final ResponseMessageService responseMessageService;
public ResponseHandler(ResponseMessageService responseMessageService) {
…

ip696
- 6,574
- 12
- 65
- 128
1
vote
1 answer
After upgrade kafka to 2.x, my UT cannot be launched after using latest EmbeddedKafkaRule
My test dependencis related to kafka as below:
| +--- org.apache.kafka:kafka_2.11:2.0.0 -> 2.0.1
| | +--- org.apache.kafka:kafka-clients:2.0.1 -> 2.1.1-cp1
| +--- org.apache.kafka:kafka-clients:2.0.0 -> 2.1.1-cp1 (*)
| +---…

Shan He
- 41
- 6
1
vote
2 answers
spring Kafka integration test listener not working
I'm trying integration testing using spring-boot and spring embedded Kafka. I'm able to produce message to spring embedded Kafka server but instead of test listener the listener in service class is trying to consume the records and…

app
- 733
- 5
- 15
- 27
1
vote
1 answer
Get data from topic after pushing in @EmbeddedKafka in spring boot Junit
I am writing Junit test cases(using @EmbeddedKafka) for my Spring Boot application which extensively uses Spring-kafka to communicate with other services and for other operations.
One typical case is deleting the data from kafka (which we are doing…

adhikari
- 112
- 2
- 13
0
votes
0 answers
Failed to create bean with name embeddedKafka , java.lang.NoSuchFieldError: DEFAULT_SOCKET_CONNECTION_SETUP_TIMEOUT_MS
When i import the @EmbeddedKafka and autowire it in the IntegrationTestContext Getting below Exception,
Failed to create bean with name embeddedKafka.
Error Stack Trace:
java.lang.IllegalStateException: Failed to load ApplicationContext
at…

ga7202
- 93
- 8
0
votes
1 answer
All embedded kafka tests in one kafka broker, one test context
I have spring application with some embedded kafka tests @EmbeddedKafka.
For each test I need a separate topic.
@ExtendWith(SpringExtension::class)
@SpringBootTest(
classes = [
Application::class
…

olga1234
- 1
0
votes
1 answer
org.springframework.kafka.KafkaException: Send failed; Topic dpp_cil.dpp.event.external.downstream_response not present in metadata after 60000 ms
Integration test for ProducerServiceIntegrationTest is giving error : org.springframework.kafka.KafkaException: Send failed; nested exception is org.apache.kafka.common.errors.TimeoutException: Topic dpp_cil.dpp.event.external.downstream_response…

Bhavana
- 11
- 1
- 4
0
votes
2 answers
Failed to be assigned partitions from the embedded topics for test
I am using spring boot and spring kafka to write contract test for my @kafkaListener which consume event from one kafka topic.
My test is defined as below:
@EmbeddedKafka(topics = {"abc.abc.topic"})
@ExtendWith(SpringExtension.class)
public class…

Ray
- 477
- 1
- 6
- 18
0
votes
1 answer
Numbers of partitions during EmbeddedKafka tests with multiple topics
I am relatively new with the subject Apache Kafka.
When I run my test with only one topic, it passes. But when I add more topics, the number of partitions increases and it always returns failure.
I have following test…

Anil
- 3
- 4
0
votes
1 answer
ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG = false is not working
SpringBoot2
SpringKafka
I'm currently facing an issue where the ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG = false is not working properly. I've set the allow.auto.create.topics to false, but the Topic still auto created during the runtime.
Here…

xiaoli
- 137
- 1
- 2
- 9
0
votes
0 answers
Kafka consumer transaction is slow, how to tweak it?
In a unit test with embeddedkafka, spring-kafka-test 3.0.6, I feel the transaction in consumer is too slow
09:10:11.000 o.s.k.l.KafkaMessageListenerContainer : Received: 1 records[]
09:10:11.100 o.a.k.c.p.internal.TransactionManager : Enqueuing…

jon
- 395
- 1
- 3
- 21
0
votes
0 answers
Kafka consumer doesn't received message within time range after change auto.offset.reset=earliest to latest in embeddedKafka junit test
In a recent common library upgrade, I found Kafka consumer doesn't received message within the expected time(2 minutes). After compared with the code and did lots of tests, looks it is caused by auto.offset.reset=latest(it was earliest). What would…

jon
- 395
- 1
- 3
- 21
0
votes
1 answer
Using spring boot kafka template to receive messages
In the context of Using Kafka with Spring boot I found a lot of examples of producing messages and receiving messages but I'm doing building a test framework to use in my code and I would like to explore more this point from the…

Miguel Costa
- 627
- 1
- 12
- 30
0
votes
1 answer
Parallelly running Embedded Kafka spring boot tests
I have some spring boot tests that are using Kafka internally. For Kafka functionality, I am using @EmbeddedKafka annotation on each of the test classes that are using Kafka (with same server on each test,…

dh1
- 97
- 1
- 9