QuickDevGuide

Home › Apache Kafka

Spring Boot Integration (Spring for Apache Kafka) — Apache Kafka

Spring for Apache Kafka wraps the clients with auto-configuration, KafkaTemplate for sending and @KafkaListener for consuming. Feature How Configuration spring.kafka. properties in application.yml Send kafkaTemplate.send(topic, key, value) → CompletableFuture Consume @KafkaListener(topics = "...", groupId = "...") Concurrency concurrency = "3" → three consumer threads Retries + DLT @RetryableTopic or DefaultErrorHandler + DeadLetterPublishingRecoverer JSON JsonSerializer / JsonDeserializer with trusted packages Testing @EmbeddedKafka or Testcontainers

Key Takeaways