I am beginner with apache kafka and trying to learn confluent - kafka - rest - utils, however I am confusing with how can I use it.
During search I found this documentation https://spring.io/blog/2015/04/15/using-apache-kafka-for-integration-and-data-processing-pipelines-with-spring
It is very good documentation but It doesn't help me to learn rest-utils.
The git code of confluent kafka rest utils is
https://github.com/confluentinc/kafka-rest is demonstrate how to use rest kafka. But I want to know the exact procedure to be more aware about it. with some simple explanation. Can anyone suggest me some links with how I use rest client. Please guide me towards this.
It might be a silly question but I don't have other option to learn.
thanks in advance.
The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of 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".
In this chapter, we are going to see how to implement the Apache Kafka in Spring Boot application. First, we need to add the Spring Kafka dependency in our build configuration file. Maven users can add the following dependency in the pom. xml file.
The Spring Integration for Apache Kafka extension project provides inbound and outbound channel adapters and gateways for Apache Kafka. Apache Kafka is a distributed publish-subscribe messaging system that is designed for high throughput (terabytes of data) and low latency (milliseconds).
The Kafka REST Proxy is a RESTful web API that allows your application to send and receive messages using HTTP rather than TCP. It can be used to produce data to and consume data from Kafka or for executing queries on cluster configuration.
First try to create a REST service using spring MVC keeping kafka stuff aside.
Once you are able run a 'hello world' kind of REST service, then pick Kafka Docs.
Refer documents on how to create a kafka cluster, and run default console consumer and producer programs to check your cluster.
Now, write a main java program and create a kafka producer using Kafka Clients API. Refer its docs. Make sure that messages sent through main program are reaching to the consumer.
Now, inject the content of this main program in rest service, so that messages passed in request body are now passed to kafka cluster and are readable by consumer.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With