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

  Рет қаралды 31,530

Java Techie

Java Techie

11 ай бұрын

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.ongraphy.com/
PROMO CODE : JAVATECHIE50
GitHub:
github.com/Java-Techie-jt/kaf...
Blogs:
/ javatechie
Facebook:
/ javatechie
Join this channel to get access to perks:
kzbin.infojoin
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

Пікірлер: 90
@satyabatigoswami1735
@satyabatigoswami1735 3 ай бұрын
Got to understand kafka by following your tutorials. So clear explanation!! You are great😇
@SivaChaitanyaReddySanivarapu
@SivaChaitanyaReddySanivarapu 11 ай бұрын
Great topic, we are using this in my billing project
@user-pi6wv9jn8j
@user-pi6wv9jn8j 11 ай бұрын
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 11 ай бұрын
Waoo super excitement.thanks buddy i will definitely cover all concepts of Kafka
@dileepkumarsattaru1909
@dileepkumarsattaru1909 11 ай бұрын
Nice Basant, Keep going with this series...
@GunelMammadova93
@GunelMammadova93 2 ай бұрын
Thanks for the amazing tutorial!
@sharmarahul17
@sharmarahul17 6 ай бұрын
Excellent video!
@ankurverma4592
@ankurverma4592 5 ай бұрын
awesome explanation able to learn the whole very well. Thank you
@ramsharan4229
@ramsharan4229 11 ай бұрын
awesome
@user-pi6wv9jn8j
@user-pi6wv9jn8j 11 ай бұрын
you are awesome Basant
@AleksandarT10
@AleksandarT10 11 ай бұрын
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 11 ай бұрын
Thanks for the tips! That's what's on my queue 🤪
@maximiliangolovach3203
@maximiliangolovach3203 11 ай бұрын
Very nice and helpful!
@Javatechie
@Javatechie 11 ай бұрын
Glad it was helpful!
@appstude6247
@appstude6247 9 ай бұрын
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 ?
@LearncodewithMuneeb
@LearncodewithMuneeb 9 ай бұрын
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
@ravi.m4954
@ravi.m4954 10 ай бұрын
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 10 ай бұрын
Yes i will cover that
@SystemDesign-fn9zu
@SystemDesign-fn9zu Ай бұрын
Thanks
@Javatechie
@Javatechie Ай бұрын
Thank you buddy 😊
@Gsuresh_3
@Gsuresh_3 11 ай бұрын
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
@user-xw5sd6dt3j
@user-xw5sd6dt3j 11 ай бұрын
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 11 ай бұрын
Either or you can add buddy. I forgot to mention that in video
@user-py3xl3et7c
@user-py3xl3et7c 10 ай бұрын
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 10 ай бұрын
We need to implement a retry i will cover that
@rishiraj2548
@rishiraj2548 11 ай бұрын
🙏💯
@VIKASSINGH-jf6jd
@VIKASSINGH-jf6jd 11 ай бұрын
Basant. How do you create this beautiful presentation ? Which tool do you use or animation ?
@Javatechie
@Javatechie 11 ай бұрын
No animation buddy it's simple Microsoft power point
@vaishalis
@vaishalis 6 ай бұрын
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 5 ай бұрын
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
@geekdeb5363
@geekdeb5363 9 ай бұрын
Great , If you can enlighten on the real time project prospective, it would be great
@Javatechie
@Javatechie 9 ай бұрын
I will do one e2e project using microservice that time will cover that scenario
@geekdeb5363
@geekdeb5363 9 ай бұрын
@@Javatechie Thank you 😊
@gauravsrivastava3884
@gauravsrivastava3884 11 ай бұрын
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 11 ай бұрын
Hi buddy it’s already there in Kafka for beginners playlist please check
@gauravsrivastava3884
@gauravsrivastava3884 11 ай бұрын
Got it. Thanks!!
@user-cd3ul1ns2q
@user-cd3ul1ns2q Ай бұрын
Hi can you create videos on Kafka stream?
@raghugattu296
@raghugattu296 10 ай бұрын
Hi, Instead of creating new consumer groups, can we not increase threads count to 3 in one method using thread property?
@Javatechie
@Javatechie 10 ай бұрын
I will cover that content buddy
@entertainer-xyz7562
@entertainer-xyz7562 5 ай бұрын
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 5 ай бұрын
Yes we can I just defined it to same consumer to just demonstrate partition and consumer relationship
@dhamodharankrishnamoorthi1921
@dhamodharankrishnamoorthi1921 19 күн бұрын
How i can create multiple consumer group, and consume message concurrent please explain
@pnamm6501
@pnamm6501 10 ай бұрын
Great video. Can you cover avro schema and retry mechanism and also how handle any exception when processing message consumption?
@Javatechie
@Javatechie 10 ай бұрын
I will do that exception handling
@pavanreddy3162
@pavanreddy3162 4 ай бұрын
how long the messages are store in kafka?
@RochaNahuel
@RochaNahuel 8 ай бұрын
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 8 ай бұрын
Yes no problem at all because message will not be duplicate
@user-tx2hl3mm3l
@user-tx2hl3mm3l 11 ай бұрын
The GOAT
@Javatechie
@Javatechie 11 ай бұрын
What?
@rajenderprasad1193
@rajenderprasad1193 11 ай бұрын
It means Greatest Of All Time- shortly GOAT
@royjose.
@royjose. 22 күн бұрын
once the consumer is enabled again, will the lag values reach the consumer automatically?
@Javatechie
@Javatechie 22 күн бұрын
Yes it will process automatically once consumer back to online
@PradeepKumar-sx6ms
@PradeepKumar-sx6ms 10 ай бұрын
Are any videos on kafka coming?
@Javatechie
@Javatechie 10 ай бұрын
Yes error handling and retry
@user-ts2wf4db2q
@user-ts2wf4db2q 8 ай бұрын
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 8 ай бұрын
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
@Chinmay0692010
@Chinmay0692010 7 ай бұрын
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 7 ай бұрын
Yes he will start picking based on what last offset he read before
@mohammedsardar3779
@mohammedsardar3779 10 ай бұрын
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 10 ай бұрын
No you are correct
@siddharthanepal1962
@siddharthanepal1962 11 ай бұрын
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 11 ай бұрын
Okay sure i will do that
@rakushhkar4225
@rakushhkar4225 11 ай бұрын
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 11 ай бұрын
@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 11 ай бұрын
@@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 10 ай бұрын
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.
@hanumanthram6754
@hanumanthram6754 10 ай бұрын
If the consumer is stopped then it should continue to consume the data based on the offset. is that correct understanding?
@Javatechie
@Javatechie 10 ай бұрын
No if the consumer is shut down then what to consume and who will consume buddy?
@hanumanthram6754
@hanumanthram6754 10 ай бұрын
@@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 10 ай бұрын
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
@kartikjain3064
@kartikjain3064 11 ай бұрын
Hi, so we no need of define ProducerFactory, ConsumerFactory in our code
@Javatechie
@Javatechie 11 ай бұрын
That will be my next video don't worry
@rahulprakash5045
@rahulprakash5045 Ай бұрын
is it required to add consumer group ?
@Javatechie
@Javatechie Ай бұрын
Yes it's mandatory steps to do
@arunprabu6137
@arunprabu6137 7 ай бұрын
Bro how to connect offset kafka
@saurabhmaurya6964
@saurabhmaurya6964 6 ай бұрын
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 6 ай бұрын
What field you are getting null ?
@saurabhmaurya6964
@saurabhmaurya6964 6 ай бұрын
@@Javatechie in the consumer.poll section..can we connect seperately on meet so I can show you there?..
@Javatechie
@Javatechie 6 ай бұрын
@@saurabhmaurya6964 sure please drop me an email to javatechie4u@gmail.com
@saravanakumars52
@saravanakumars52 11 ай бұрын
What about @EnableKafka annotation??
@Javatechie
@Javatechie 11 ай бұрын
Not mandatory
@saurabhsuradkar1626
@saurabhsuradkar1626 5 ай бұрын
consumer is not able to receive msg or connect to broker
@ReplayButton_7518
@ReplayButton_7518 7 ай бұрын
It is not working for me can , the message producer worked fine but I got nothing on message consumer
@CharanSaiAnnam
@CharanSaiAnnam 5 ай бұрын
Share your repository we will debug
@VINOTHCH
@VINOTHCH 3 ай бұрын
@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 3 ай бұрын
Are you using SQS ?
@VINOTHCH
@VINOTHCH 3 ай бұрын
@@Javatechie I’m using Kafka
@aces8481
@aces8481 22 күн бұрын
bro zoom in lol the text is tiny at times
Apache Kafka® Producer Example using SpringBoot 3.x | Java Techie
25:59
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
Про Kafka (основы)
49:23
Владимир Богдановский
Рет қаралды 363 М.
4 Spring Boot Mistakes to AVOID in 2024
15:18
Java Brains
Рет қаралды 53 М.
Apache Kafka in 6 minutes
6:48
James Cutajar
Рет қаралды 957 М.
Нашел еще 70+ нововведений в iOS 18!
11:04
сюрприз
1:00
Capex0
Рет қаралды 1,5 МЛН
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 2,2 МЛН