Spring Boot + Apache Kafka Tutorial - #12 - Create REST API to Send JSON Object

  Рет қаралды 44,997

Java Guides

Java Guides

Күн бұрын

Welcome to Spring Boot + Apache Kafka Tutorial series.
In this lecture, we will create a REST API to send a JSON message in request. The REST API intern converts JSON into a User object and sends it to Kafka Producer. Kafka Producer intern sends that user object to Kafka topic.
#springboot #kafka #javaguides
Complete playlist at • Spring Boot + Apache K...
GitHub link: github.com/Ram...

Пікірлер: 32
@УмарКаригов
@УмарКаригов Жыл бұрын
Спасибо огромное!!!! Ты очень хорошо все объясняешь.👍👍👍👍
@johnbrooks8839
@johnbrooks8839 Жыл бұрын
Those who are getting the error trying to cast your User object to a String may need to update your producer properties to have a key serializer and value serializer instead of "deserializer".
@krishnasarkar252
@krishnasarkar252 Жыл бұрын
I have added this but still got same error
@krishnamadhav7639
@krishnamadhav7639 6 ай бұрын
At 2:07, you have added PostMapping("/publish") and in the previous video in MessageController class you have added GetMapping("/publish"). Can you please explain the reason behind it? Please clarify this. As per my understanding at both the places it should be GetMapping annotation only.
@anshikamishra5938
@anshikamishra5938 Жыл бұрын
Some of the windows commands are not working for me giving "The syntax for the command is incorrect" specially when using --from-beginning
@meduriravindra4238
@meduriravindra4238 2 жыл бұрын
Please explain how to consume old data from Kafka after the old data get updated. Is it a possible scenario atleast from interview point of view ?
@shailendraraj4951
@shailendraraj4951 Жыл бұрын
great explanation
@Andrzej3935
@Andrzej3935 10 ай бұрын
Greate lessons
@arthurmukelyan404
@arthurmukelyan404 6 ай бұрын
Hi, I am getting 405 request method not supported, but I can’t understand why, anyone can help me?
@MDAnashAnsari
@MDAnashAnsari 8 ай бұрын
Replace your KafkaConsumer class code with the below code if you are getting :- org.apache.kafka.common.errors.SerializationException: Can't convert value of class com.vinay.kafka.payload.User to class org.apache.kafka.common.serialization.StringSerializer public class KafkaConsumer { @KafkaListener(topics = "nepdroid", groupId = "myGroup") public void consume(User user) { log.info(String.format("Message received -> %s", user.toString())); } }
@vinay2841
@vinay2841 Жыл бұрын
Anyone please help me to resolve this error org.apache.kafka.common.errors.SerializationException: Can't convert value of class com.vinay.kafka.payload.User to class org.apache.kafka.common.serialization.StringSerializer
@shanmugamsekar2070
@shanmugamsekar2070 Жыл бұрын
i also get this error
@vinay2841
@vinay2841 Жыл бұрын
@@shanmugamsekar2070 Have u got a solution?
@sanyamkharche6646
@sanyamkharche6646 Жыл бұрын
@@vinay2841 To ensure that the User class is properly serialized and deserialized as JSON, you need to add the necessary Jackson annotations.e.g. @JsonProperty annotation. Add this dependency in your pom.xml if using a spring boot project. com.fasterxml.jackson.core jackson-databind
@wahyuusman6777
@wahyuusman6777 Жыл бұрын
many thanks about your tutorial, cuz your video i very help for learning about kafka
@pavanraju6485
@pavanraju6485 2 жыл бұрын
How to consume data by using browser or postman?
@tonydeveloperdndndn
@tonydeveloperdndndn Жыл бұрын
Nice presentation and explanation.
@JavaGuides
@JavaGuides Жыл бұрын
Glad you liked it!
@adityakendhe5630
@adityakendhe5630 2 жыл бұрын
hello sir, I am getting null pointer exception related to kafka template while using rest api to send json object on console. And in postman it is showing internal server error. please help.
@PeaFootballer
@PeaFootballer 2 жыл бұрын
I am getting the same error too did u get solution?
@adityakendhe5630
@adityakendhe5630 2 жыл бұрын
@@PeaFootballer my code is correct...so i guess its due to some of the libraries or dependencies missing on our IDE unlike used in lecture. In better way i skipped it and and continued with lecture. in next lecture he made real time project. Thats important.
@lky100047
@lky100047 Жыл бұрын
add import org.apache.kafka.common.serialization.StringSerializer; import org.springframework.kafka.support.serializer.JsonSerializer; to every java class work for me
@poojagamskar6872
@poojagamskar6872 Жыл бұрын
recheck the previous learning vedio u must have missed creating constructor for kafka template,so u r getting null pointer exception
@elakkiyap5509
@elakkiyap5509 Жыл бұрын
hai sir. i tried to send Json Message to kafka topic but am getting internal server error in postman . As well as in intellij, ERROR [dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.kafka.common.errors.SerializationException: Can't convert value of class in.inspired.services.model.User to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer] with root cause java.lang.ClassCastException: class in.inspired.services.model.User cannot be cast to class java.lang.String (in.inspired.services.model.User is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')...how to overcome this error. kindly help in this
@newtanagmukhopadhyay4716
@newtanagmukhopadhyay4716 Жыл бұрын
did you resolve it?
@elakkiyap5509
@elakkiyap5509 Жыл бұрын
@@newtanagmukhopadhyay4716 yes sir. i resolved it. however thank you for your presence to help me.
@newtanagmukhopadhyay4716
@newtanagmukhopadhyay4716 Жыл бұрын
@@elakkiyap5509 ah dont call me sir pls its embrassing for me. im just 22
@elakkiyap5509
@elakkiyap5509 Жыл бұрын
@@newtanagmukhopadhyay4716oh. Am sorry.
@divyanshukumar5460
@divyanshukumar5460 Жыл бұрын
Even I am getting this error, can u please help me to resolve this
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 56 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 89 МЛН
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 70 МЛН
Kafka Tutorial - Spring Boot Microservices
51:29
Amigoscode
Рет қаралды 426 М.
Apache Kafka in 6 minutes
6:48
James Cutajar
Рет қаралды 1 МЛН
Deep Dive into REST API Design and Implementation Best Practices
12:02
Software Developer Diaries
Рет қаралды 52 М.
Spring Boot Restful APIs Tutorial
1:25:06
Cameron McKenzie
Рет қаралды 3,9 М.
Simple Kafka producer in Java | Kafka Producer | Java | Kafka
18:37
CodeWithRajRanjan
Рет қаралды 54 М.
Difference Between REST API vs Web API vs SOAP API Explained
7:24
Learn with Whiteboard
Рет қаралды 210 М.