Questions tagged [spring-kafka]

The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of Apache Kafka-based messaging solutions.

The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of Apache Kafka-based messaging solutions. It provides a "template" as a high-level abstraction for sending messages. It also provides support for Message-driven POJOs with @KafkaListener annotations and a "listener container". These libraries promote the use of dependency injection and declarative. In all of these cases, you will see similarities to the JMS support in the Spring Framework and RabbitMQ support in Spring AMQP.

has a module spring-integration-kafka providing channel adapters and gateways based on spring-kafka.

Resources

See Also

4185 questions
1
vote
1 answer

Create message liseners dynamically for the topics

I was analysing a problem on creating a generic consumer library which can be deployed in multiple microservices ( all of them are spring based) . The requirement is to have around 15-20 topics to listen .If we use annotation based kafka listener…
Rajasekhar
  • 45
  • 5
1
vote
1 answer

Kafka Producer Callback performance

I have Kafka Produce which sends the message to kafka .And i log the message in database in the both onsucess and onFailure with the help stored procedure . As shown in the code i am using asynchronous should i mark my callStoredProcedure method…
1
vote
1 answer

APPLICATION FAILED TO START because method required a single bean, but 4 were found JUnit 5 + Spring Kafka

Writing the JUnit test to test the controller method, mocking the service methods using Mockito. service class @Service public record ProductProducer(ReplyingKafkaTemplate _replyTemplate, …
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
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

Kafka uncaught exception

I am getting the following exception while the producer is publishing the first message, I am trying to understand what the error means Uncaught exception in thread 'kafka-producer-network-thread | producer-1': java.lang.AbstractMethodError: Method…
Vikas Tiwari
  • 517
  • 5
  • 16
1
vote
1 answer

RecordTooLargeException in kafka

the following is kafka publishing code which is giving RecordTooLargeException exception. tried all possible solutions given in stackoverflow giving info about different properties like max.request.size etc. but nothing worked. exact stack trace…
Vivek Kella
  • 41
  • 2
  • 5
1
vote
0 answers

Kafka Stream using same predicate to send the message to multiple branches

I needed to have same message to be given to two different branch but reading from single stream. Both branches should get all messages (i.e. my predicate for both branches is same. I tried below code but I see only first branch is…
1
vote
1 answer

Does Kafka consumer fetch-min-size (fetch.min.bytes) wait for the mentioned size to get filled?

Suppose there are 107 records, each record is 1kb. If the fetch-size is 15kb, in 7 iterations 105kb would be consumed. Now, only 2kb is remaining, will I get the remaining 2 records in next iterations or will it wait for more 15kb to be accumulated?…
1
vote
1 answer

How to load Kafka Consumer lazily in Spring boot?

I want to provide group Id through command line argument but when I tried this I got following error. Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is java.lang.IllegalStateException:…
vijayk
  • 2,633
  • 14
  • 38
  • 59
1
vote
1 answer

Spring Cloud Stream (Kafka) parameterize specified error channel {destination}.{group}.errors

I am trying to see if the error channel I am passing to @ServiceActivator can be bounded/parameterized referring the value specified in YAML instead of hardcoding actual destination and consumer group in the code itself. @ServiceActivator( …
1
vote
1 answer

Replace Spring Java config with XML for Apache Kafka

Ho can be replaced a Java configuration like this @Configuration @EnableKafka public class KafkaConfig { } With a full XML configuration? Especially how can be methods (or classes) annotated with @KafkaListener public void poll(String…
andPat
  • 4,153
  • 7
  • 24
  • 36
1
vote
1 answer

Kafka Spring Deserialzer returnType static method never called

Here is the error I get: org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition distance-0 at offset 0. If needed, please seek past the record to continue consumption. Caused by:…
Roger Alkins
  • 125
  • 11
1
vote
1 answer

How to make the application self-recover from Reactor Kafka's RetriableCommitFailedException caused by request timeout?

I have a Kafka processor that is defined like this. import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.common.serialization.StringDeserializer import org.slf4j.LoggerFactory import…
1
vote
1 answer

Failed to create new KafkaAdminClient

I get the following error whenever trying to run my spring boot Kafka application. 2020-08-04 20:17:23.366 ERROR 2827 --- [ main] o.springframework.kafka.core.KafkaAdmin : Could not create admin org.apache.kafka.common.KafkaException:…
Arya Shrivastava
  • 13
  • 1
  • 1
  • 4
1
vote
1 answer

start kafka consumer once event is completed

My Spring boot application does two task Initialise cache kafka consumer Already have a ApplicationEvent for cache initialisation and I want consumer to start listening the messages once cache initialisation is completed.