KafkaTemplate
KafkaTemplate is a Spring for Apache Kafka API class that provides high-level operations for sending records to Kafka topics.
Kafka Streams in Action, Second Edition
KafkaTemplate is a Spring Kafka class that provides high-level methods for sending records to Kafka topics.
- How it is used
- Publishes processed loan application records from Spring components to selected Kafka topics.
- How deep it goes
- Explains constructor injection, send arguments, completion callbacks, and concurrent sharing; defers Java threading and synchronization.
- Examples
- Uses a loan processor that routes approved or rejected applications and optionally copies results to a QA topic.
- What you can do after
- Apply it via Spring Kafka to send keyed records and attach callbacks that log broker-produced metadata or errors.
Read how Kafka Streams in Action, Second Edition explains KafkaTemplate →
Spring in Action, Sixth Edition
KafkaTemplate is a Spring for Apache Kafka API class that sends records to and receives records from Kafka topics.
- How it is used
- Provides an injected Spring client for publishing application domain objects asynchronously to Kafka topics.
- How deep it goes
- Explains dependency setup, broker configuration, typed send signatures, optional record fields, and a service implementation.
- Examples
- Uses a TacoOrder service, the tacocloud.orders.topic topic, localhost:9092, and a sendDefault variant.
- What you can do after
- Apply it via Spring Kafka by injecting a typed template and sending domain objects to named or configured default topics.
Read how Spring in Action, Sixth Edition explains KafkaTemplate →
Related concepts
- Spring Boot autoconfigurationproduced by · Spring Boot autoconfiguration is the conditional automatic selection and configuration of application components based on dependencies, properties, environment, and application context.
- RabbitTemplatecontrasts with · RabbitTemplate is a Spring AMQP API element that provides operations for sending and receiving messages through RabbitMQ.
- JmsTemplatecontrasts with · JmsTemplate is a Spring API that simplifies JMS message production and consumption by managing messaging boilerplate and exceptions.
- Apache Kafkauses · Apache Kafka is a distributed event-streaming platform for publishing, storing, processing, and consuming streams of records.
- Kafka brokeruses · A Kafka broker is a server process in an Apache Kafka cluster that stores records and handles producer, consumer, and other client requests.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

