Apache Kafka® Consumer Example using SpringBoot 3 | Consumer Groups | Java Techie

  Рет қаралды 39,082

Java Techie

Java Techie

Күн бұрын

In this tutorial, we will be creating a simple Kafka consumer using Spring Boot 3.0 and will understand below key points
👉 How to consume events from topic
👉 How kafka makes partition and consumer mapping
👉 Offset Explorer to visualize kafka events and lags
#JavaTechie #SpringBoot #Kafka
Spring boot microservice Premium course lunched with 70% off 🚀 🚀
Hurry-up & Register today itself!
COURSE LINK : javatechie5246...
PROMO CODE : JAVATECHIE50
GitHub:
github.com/Jav...
Blogs:
/ javatechie
Facebook:
/ javatechie
Join this channel to get access to perks:
www.youtube.co...
guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
Disclaimer/Policy:
--------------------------------
Note : All uploaded content in this channel is mine and its not copied from any community ,
you are free to use source code from above mentioned GitHub account

Пікірлер: 92
@satyabatigoswami1735
@satyabatigoswami1735 6 ай бұрын
Got to understand kafka by following your tutorials. So clear explanation!! You are great😇
@amankumar-f4n5r
@amankumar-f4n5r Жыл бұрын
just started watching your video of kafka today at 10 am morning. I couldn't stop myself and its 2 am next day just completed your all videos of kafka with hands on. Just one suggestions keep your kafka consumer topic in kafka playlist otherwise many can miss tracking this .Also i'm waiting for other kafka topics like kafka connect with database where messages are being received from different source system which kafka server listen and stores those in our database and vice versa
@Javatechie
@Javatechie Жыл бұрын
Waoo super excitement.thanks buddy i will definitely cover all concepts of Kafka
@SivaChaitanyaReddySanivarapu
@SivaChaitanyaReddySanivarapu Жыл бұрын
Great topic, we are using this in my billing project
@AleksandarT10
@AleksandarT10 Жыл бұрын
Great video! Explains how Kafka Consumers work pretty clearly. As an idea for the next video/s, you can go over more of the properties of Kafka for Producers/Consumers - and explain concepts like batching, the most common properties that can be configured (like manual acknowledgement or not) etc
@Javatechie
@Javatechie Жыл бұрын
Thanks for the tips! That's what's on my queue 🤪
@dileepkumarsattaru1909
@dileepkumarsattaru1909 Жыл бұрын
Nice Basant, Keep going with this series...
@ravi.m4954
@ravi.m4954 Жыл бұрын
Nice explanation. Can you cover in upcoming videos like how can we replay or retry lagged messages and how to identify which messages lagged and how to replay those .
@Javatechie
@Javatechie Жыл бұрын
Yes i will cover that
@shubhammotghare783
@shubhammotghare783 18 күн бұрын
Hey, 1st of all thank you for the great tutorial. I've one question. When you change the group-id in service class, is it not mandatory to change or add that new group-id in application.yml ?
@vaishalis
@vaishalis 9 ай бұрын
Hi Basant, thank you for an excellent informative video. What I do not understand about the lag is, if Kafka stores the messages for minimum one week, then why do we have to republish the messages which are in the lag. Why it will not automatically be reprocessed when the consumer is back up and running?
@Javatechie
@Javatechie 9 ай бұрын
It will automatically be consumed by the consumer once it goes back to online. But republish required when you want to resend a particular events
@GunelMammadova93
@GunelMammadova93 6 ай бұрын
Thanks for the amazing tutorial!
@BhanuNandanaPavanKumarBavirise
@BhanuNandanaPavanKumarBavirise Сағат бұрын
How to write consumer instances dynamically in a single method...for every consumer instance you have created one method but only one method should multiple consumer instances naa?
@gauravsrivastava3884
@gauravsrivastava3884 Жыл бұрын
Hi Basant !! Can you please all the necessary videos of this particular Kafka series to a KZbin Playlist. It will make it easy to access all relevant videos from one place. And as and when you create new videos, you can add them to the playlist. Thanks!
@Javatechie
@Javatechie Жыл бұрын
Hi buddy it’s already there in Kafka for beginners playlist please check
@gauravsrivastava3884
@gauravsrivastava3884 Жыл бұрын
Got it. Thanks!!
@SandeepPuvvada-u5p
@SandeepPuvvada-u5p Жыл бұрын
Good Explanation basant. Great work. I have one quick question you change the group id in the java class but not changed in yml still application works fine. Then what is the point of adding the group id in yml.
@Javatechie
@Javatechie Жыл бұрын
Either or you can add buddy. I forgot to mention that in video
@ankurverma4592
@ankurverma4592 8 ай бұрын
awesome explanation able to learn the whole very well. Thank you
@mohammedsardar3779
@mohammedsardar3779 Жыл бұрын
Mesage consumption is decided by leader broker and not by the zookeeper. Zukeeper will be keeping the status of brokers and act as coordinator for all the brokers. Am I wrong Basant?
@Javatechie
@Javatechie Жыл бұрын
No you are correct
@LearncodewithMuneeb
@LearncodewithMuneeb Жыл бұрын
Thanks sir for making useful videos for us. But I request you very respectfully to work in a project in spring boot having at least 6 entities/tables using spring boot in the back end and React/Angular/Next in the front end
@Зебратв-п7э
@Зебратв-п7э Жыл бұрын
thank you for your tutuorial easy to understand but i have question is it possible to miss data in kafka between producer and consumer process if it likes that how can i avoid missing data
@Javatechie
@Javatechie Жыл бұрын
We need to implement a retry i will cover that
@RochaNahuel
@RochaNahuel 11 ай бұрын
The example is clear and I like it , but these 3 consumers who are listening to the same topic and working together , could call the same method of the logica layer without problems ?
@Javatechie
@Javatechie 11 ай бұрын
Yes no problem at all because message will not be duplicate
@amankumar-f4n5r
@amankumar-f4n5r Жыл бұрын
you are awesome Basant
@appstude6247
@appstude6247 Жыл бұрын
thank you for the video. can please tell me what's will happen if you start kafka-consumer-example project twice ? how many consumer will have ? 3 consumer in each instance ?
@maximilian_gl
@maximilian_gl Жыл бұрын
Very nice and helpful!
@Javatechie
@Javatechie Жыл бұрын
Glad it was helpful!
@VIKASSINGH-jf6jd
@VIKASSINGH-jf6jd Жыл бұрын
Basant. How do you create this beautiful presentation ? Which tool do you use or animation ?
@Javatechie
@Javatechie Жыл бұрын
No animation buddy it's simple Microsoft power point
@raghugattu296
@raghugattu296 Жыл бұрын
Hi, Instead of creating new consumer groups, can we not increase threads count to 3 in one method using thread property?
@Javatechie
@Javatechie Жыл бұрын
I will cover that content buddy
@geekdeb5363
@geekdeb5363 Жыл бұрын
Great , If you can enlighten on the real time project prospective, it would be great
@Javatechie
@Javatechie Жыл бұрын
I will do one e2e project using microservice that time will cover that scenario
@geekdeb5363
@geekdeb5363 Жыл бұрын
@@Javatechie Thank you 😊
@Gsuresh_3
@Gsuresh_3 Жыл бұрын
Hello, Recently I faced a question in interview, if I give a java project along with remote server without any IDE how you run that project. Can you make a video on it
@dhamodharankrishnamoorthi1921
@dhamodharankrishnamoorthi1921 3 ай бұрын
How i can create multiple consumer group, and consume message concurrent please explain
@RaviKumar-v9b6m
@RaviKumar-v9b6m 4 ай бұрын
Hi can you create videos on Kafka stream?
@Chinmay0692010
@Chinmay0692010 10 ай бұрын
If consumers get shut down while consuming, so if we start again the consumers , will it not take those messages which was not consumed….?
@Javatechie
@Javatechie 10 ай бұрын
Yes he will start picking based on what last offset he read before
@entertainer-xyz7562
@entertainer-xyz7562 8 ай бұрын
Hi Basant , I was going through this Kafka tutorial, I got a question on groupid that you have assigned to multiple consumers. My question is can we provide different groupid to different consumers?
@Javatechie
@Javatechie 8 ай бұрын
Yes we can I just defined it to same consumer to just demonstrate partition and consumer relationship
@sharmarahul17
@sharmarahul17 9 ай бұрын
Excellent video!
@royjose.
@royjose. 3 ай бұрын
once the consumer is enabled again, will the lag values reach the consumer automatically?
@Javatechie
@Javatechie 3 ай бұрын
Yes it will process automatically once consumer back to online
@ramsharan4229
@ramsharan4229 Жыл бұрын
awesome
@pnamm6501
@pnamm6501 Жыл бұрын
Great video. Can you cover avro schema and retry mechanism and also how handle any exception when processing message consumption?
@Javatechie
@Javatechie Жыл бұрын
I will do that exception handling
@SystemDesign-fn9zu
@SystemDesign-fn9zu 4 ай бұрын
Thanks
@Javatechie
@Javatechie 4 ай бұрын
Thank you buddy 😊
@saurabhmaurya6964
@saurabhmaurya6964 9 ай бұрын
how can we fetch all the messages from the particular topic after hitting end-point url ?..Help me with this..I tried To do with the help of KafkaConsumer consumer .. this has a method poll .. but after hitting end point i'm getting null in consumer..please help me with this ..
@Javatechie
@Javatechie 9 ай бұрын
What field you are getting null ?
@saurabhmaurya6964
@saurabhmaurya6964 9 ай бұрын
@@Javatechie in the consumer.poll section..can we connect seperately on meet so I can show you there?..
@Javatechie
@Javatechie 9 ай бұрын
@@saurabhmaurya6964 sure please drop me an email to javatechie4u@gmail.com
@kartikjain3064
@kartikjain3064 Жыл бұрын
Hi, so we no need of define ProducerFactory, ConsumerFactory in our code
@Javatechie
@Javatechie Жыл бұрын
That will be my next video don't worry
@NareshSilpa-o1h
@NareshSilpa-o1h 11 ай бұрын
Hi brother, Good Evening, i would like to join your - Spring boot & Micro service sessions. so Kindly guide me on that, How to register and talk to you. Thanks!
@Javatechie
@Javatechie 11 ай бұрын
Hello buddy please checkout any video description I have shared the course link and coupon code for course but still if you are getting confused then please refer to this video kzbin.info/www/bejne/bmWui5Rqmat_itE
@siddharthanepal1962
@siddharthanepal1962 Жыл бұрын
Hi can you make video for how kafka handle duplicates events or messages. What if producer send same events/message twice and how consumer will acknowledge the duplicates?
@Javatechie
@Javatechie Жыл бұрын
Okay sure i will do that
@rakushhkar4225
@rakushhkar4225 Жыл бұрын
How does your Producer send messages in the Queue is most important. If you send messages in a sequential way using some ID like OrderId then the message content may be duplicated but atleast the order is not. Resending messages is required if original previous message were not processed properly. There is Transaction API that supports Once Processing. Alternative is to have a Dedupe check on Consumer. But why are you insisting on non to allow duplicate messages is to be answered by you.
@siddharthanepal1962
@siddharthanepal1962 Жыл бұрын
@rakushhkar4225 Recently, in an interview, I got this question. The interviewer asked me what happens when an exception occurs during message processing on the consumer side. How will the consumer process the failed messages? I am a beginner with kafka. If you have some videos tutorial or sameple codes, please suggest.
@rakushhkar4225
@rakushhkar4225 Жыл бұрын
@@siddharthanepal1962 Also better get RabbitMQ installed to see the console where all messages are processed and stored and the parameter D is very important. Work on Stream and Quorum messages in detail too along with Classic type
@mohammedsardar3779
@mohammedsardar3779 Жыл бұрын
There is an Idempotency property along with producer that helps here to avoid duplicates message process. Just shared a point of knowledge. If this is enabled broker will ignore the repetative message for uniqueness.
@pavanreddy3162
@pavanreddy3162 7 ай бұрын
how long the messages are store in kafka?
@hanumanthram6754
@hanumanthram6754 Жыл бұрын
If the consumer is stopped then it should continue to consume the data based on the offset. is that correct understanding?
@Javatechie
@Javatechie Жыл бұрын
No if the consumer is shut down then what to consume and who will consume buddy?
@hanumanthram6754
@hanumanthram6754 Жыл бұрын
@@Javatechie I mean if that consumer stopped nd again restarted that consumer will continue to consume the data based on offset. Is that not possible. Like in real-time producer produced data and stored in topic and consumer should consume data and put that in database if consumer server stopped in the middle and again again restarted can't that consumer group continue to consume the data based on offset? It is my question
@hanumanthram6754
@hanumanthram6754 Жыл бұрын
Offset Management: 1. Kafka maintains the offset for each consumer group. When a consumer reads messages from a topic, it keeps track of the offset of the last message it has processed for each partition. The offset is stored in a Kafka topic called __consumer_offsets. Kafka brokers manage the offset commits and offsets are periodically committed by the consumer group coordinator. Consumer Restart Behavior: 2. When a consumer is stopped or goes down, the next time it restarts, it will retrieve its last committed offset for each partition from the __consumer_offsets topic. Upon restarting, the consumer will begin to consume messages from the topics starting at the last committed offset for each partition. This ensures that the consumer continues from where it left off, processing messages that were not yet consumed before the shutdown
@rahulprakash5045
@rahulprakash5045 4 ай бұрын
is it required to add consumer group ?
@Javatechie
@Javatechie 4 ай бұрын
Yes it's mandatory steps to do
@rishiraj2548
@rishiraj2548 Жыл бұрын
🙏💯
@ReplayButton_7518
@ReplayButton_7518 10 ай бұрын
It is not working for me can , the message producer worked fine but I got nothing on message consumer
@CharanSaiAnnam
@CharanSaiAnnam 9 ай бұрын
Share your repository we will debug
@PradeepKumar-sx6ms
@PradeepKumar-sx6ms Жыл бұрын
Are any videos on kafka coming?
@Javatechie
@Javatechie Жыл бұрын
Yes error handling and retry
@saurabhsuradkar1626
@saurabhsuradkar1626 8 ай бұрын
consumer is not able to receive msg or connect to broker
@saravanakumars52
@saravanakumars52 Жыл бұрын
What about @EnableKafka annotation??
@Javatechie
@Javatechie Жыл бұрын
Not mandatory
@Derrick-f8m
@Derrick-f8m Жыл бұрын
The GOAT
@Javatechie
@Javatechie Жыл бұрын
What?
@rajenderprasad1193
@rajenderprasad1193 Жыл бұрын
It means Greatest Of All Time- shortly GOAT
@arunprabu6137
@arunprabu6137 10 ай бұрын
Bro how to connect offset kafka
@VINOTHCH
@VINOTHCH 7 ай бұрын
@javatechie i need your help to complete a work. it is very urgent i'm subscribing a topic and i need to interpret the topic message and save it dynamodb
@Javatechie
@Javatechie 7 ай бұрын
Are you using SQS ?
@VINOTHCH
@VINOTHCH 7 ай бұрын
@@Javatechie I’m using Kafka
@aces8481
@aces8481 3 ай бұрын
bro zoom in lol the text is tiny at times
Apache Kafka® Producer Example using SpringBoot 3.x | Java Techie
25:59
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН
POV: Your kids ask to play the claw machine
00:20
Hungry FAM
Рет қаралды 18 МЛН
Expected Ending?
00:45
ISSEI / いっせい
Рет қаралды 6 МЛН
Apache Kafka® Consumers and Consumer Group Protocol
15:08
Confluent
Рет қаралды 21 М.
Kafka Tutorial - Spring Boot Microservices
51:29
Amigoscode
Рет қаралды 424 М.
Про Kafka (основы)
49:23
Владимир Богдановский
Рет қаралды 394 М.
Microservices using SpringBoot | Full Example
1:21:39
Daily Code Buffer
Рет қаралды 1 МЛН
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН