Kafka Streams using Spring Cloud Stream | Microservices Example | Tech Primers

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ต.ค. 2024
  • This video covers how to leverage Kafka Streams using Spring Cloud stream by creating multiple spring boot microservices
    📌 Related Links
    =============
    🔗 Github code: github.com/Tec...
    🔗 Kafka setup: docs.confluent...
    🔗 Public Domain API: domainsdb.info/
    📌 Related Videos
    ===============
    🔗 Spring Boot with Spring Kafka Producer example - • Spring Boot with Sprin...
    🔗 Spring Boot with Spring Kafka Consumer example - • Spring Boot with Sprin...
    📌 Related Playlist
    ================
    🔗Spring Boot Primer - • Spring Boot Primer
    🔗Spring Cloud Primer - • Spring Cloud Primer
    🔗Spring Microservices Primer - • Spring Microservices P...
    🔗Spring JPA Primer - • Spring JPA Primer
    🔗Java 8 Streams - • Java 8 Streams
    🔗Spring Security Primer - • Spring Security Primer
    💥 Join TechPrimers Slack Community: bit.ly/JoinTec...
    💥 Telegram: t.me/TechPrimers
    💥 TechPrimer HindSight (Blog): / techprimers
    💥 Website: techprimers.com
    💥 Slack Community: techprimers.sl...
    💥 Twitter: / techprimers
    💥 Facebook: TechPrimers
    💥 GitHub: github.com/Tec... or techprimers.gi...
    🎬Video Editing: FCP
    ---------------------------------------------------------------
    🔥 Disclaimer/Policy:
    The content/views/opinions posted here are solely mine and the code samples created by me are open sourced.
    You are free to use the code samples in Github after forking and you can modify it for your own use.
    All the videos posted here are copyrighted. You cannot re-distribute videos on this channel in other channels or platforms.
    #KafkaStreams #SpringCloudStream #TechPrimers

ความคิดเห็น • 141

  • @cheshvikaraj7769
    @cheshvikaraj7769 ปีที่แล้ว +2

    nice explanation. Thank you

  • @panndey
    @panndey 3 ปีที่แล้ว

    Great video explained both the ways of vanilla Kafka way as well as Kafka Streams using spring cloud binder .

  • @ljka
    @ljka 3 ปีที่แล้ว +1

    Cool. I like how you explain and go directly to what is needed to make things work. No too many speeches; because we can find that in the documentation ourselves.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Cheers bud #TimeIsPrecious

  • @melwin-dmello-dev
    @melwin-dmello-dev ปีที่แล้ว +1

    Just what I was looking for!!! Thank you for posting this helpful content!

  • @dheereshsingh6415
    @dheereshsingh6415 6 หลายเดือนก่อน +1

    tremendous effort to make this stuff so good and understandable

    • @TechPrimers
      @TechPrimers  5 หลายเดือนก่อน

      Glad you found it useful

  • @kylemarcus1152
    @kylemarcus1152 2 ปีที่แล้ว +1

    Wow awesome video! Learned a lot, Kafka Streams API is very powerful

  • @williandougherty6674
    @williandougherty6674 3 ปีที่แล้ว +4

    Great tutorial! Good to see in practice the difference between Kafka and Kafka Stream!

  • @diogennesthesinope61
    @diogennesthesinope61 3 ปีที่แล้ว +2

    Never seen this explained so clearly. Great job!

  • @ankitjain6437
    @ankitjain6437 3 ปีที่แล้ว +1

    Ajay !!You are simply incredible...Thanks a ton for sharing such a valuable Kafka usage pattern..You Rock !!

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Cheers Ankit. Glad it's helpful

  • @PrashantZombade
    @PrashantZombade ปีที่แล้ว +1

    Nicely explained, thanks for such a great tutorial!

  • @udit9337
    @udit9337 2 ปีที่แล้ว +1

    Excellent Kafka tutorial thanks

  • @ambarishkapil8004
    @ambarishkapil8004 4 หลายเดือนก่อน +1

    Damn! you really coded it all up under 30 mins. Sr. Dev spotted I guess XD

  • @jaineshmodi
    @jaineshmodi 3 ปีที่แล้ว

    man this is the best I have seen on Kafka stream.

  • @riteshsingh1245
    @riteshsingh1245 2 ปีที่แล้ว +1

    Very Nice tutorial for Kafka Streams

  • @balachandran7777
    @balachandran7777 3 ปีที่แล้ว +1

    Really liked it. Great efforts made for clear understanding.

  • @manognajoshik8465
    @manognajoshik8465 ปีที่แล้ว +2

    Hi Ajay..I am a regular follower of your tutorial.. Could you please make a complete video on project reactor (Spring webflux) covering every concept? If already available, kindly provide me the link.

  • @reachkrishnaraj
    @reachkrishnaraj 2 ปีที่แล้ว

    Another concise and helpful AV. Appreciate it, buddy.

  • @SandeshReddy
    @SandeshReddy 3 ปีที่แล้ว +1

    Great session👍nice use case with kafka stream processing with spring

  • @JameS00989
    @JameS00989 3 ปีที่แล้ว +1

    Very 🔥 nice video clearly explained waiting for more such video and thanks for amazing content 🙏

  • @narendrakumariitb
    @narendrakumariitb 2 ปีที่แล้ว +1

    Thank you for such an easy explanation 🙏

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว

      Glad it was helpful!

  • @maheswarbehera1
    @maheswarbehera1 3 ปีที่แล้ว +1

    Great educational video bro. It will be great if you can add Kafka Connect and ksql db too.

  • @allaboutmusicanddance5108
    @allaboutmusicanddance5108 ปีที่แล้ว +1

    Great tutorial thankyou 🧿

  • @cultOfApple
    @cultOfApple ปีที่แล้ว +1

    Great , this is super awesome and v complete and realistic one

    • @TechPrimers
      @TechPrimers  ปีที่แล้ว

      Thank you so much 😀

  • @daccu8633
    @daccu8633 2 ปีที่แล้ว +1

    thanks a lot. it is very helpful for kafka beginner

  • @jcrshankar
    @jcrshankar 3 ปีที่แล้ว +1

    Good one buddy.. please add error/exception handling

  • @alfred.g
    @alfred.g 3 ปีที่แล้ว +1

    Best educational video! But what if there is a deserialization error? How to pre-log a message that caused the application to crash?

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว +1

      You can add a Spring interceptor to log those.

  • @balajiarumugam1876
    @balajiarumugam1876 2 ปีที่แล้ว

    Clean 💥👏👏. Can you provide list of the Mac shortcuts you used in intellij .. I couldn't able get from the bottom hints?

  • @rakeshroshan829
    @rakeshroshan829 2 ปีที่แล้ว +1

    Thank you Ajay. This is very informatic and easy to comparable with kafka and kafka stream. Please Can u make a video on Kafka connect with other messaging system like activemq and with other data source like oracle ..

  • @dheerajsachan5808
    @dheerajsachan5808 2 ปีที่แล้ว

    Hey Thanks for the explanation, I really learnt something today :) , I have a question what if I wan to read from two kafka topics and send it to two kafka topics, in that case how will be my application.yaml. Thanks in advance.

  • @siddheshlatkar2165
    @siddheshlatkar2165 ปีที่แล้ว +1

    Great tutorial. Thanks!

  • @SaiKumar-vf9lz
    @SaiKumar-vf9lz 3 ปีที่แล้ว +1

    Much needed .. Stay safe Ajay .. thank you for the awesome work

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      You too stay Safe Sai. Thank you👍

  • @arungore6578
    @arungore6578 3 ปีที่แล้ว

    Thank you for the tutorials.
    What is the difference between spring kafka and spring cloud stream , spring stream kafka.
    When we should go for spring Kafka and Kafka Stream ?

  • @anandhnarendra9230
    @anandhnarendra9230 2 ปีที่แล้ว +1

    Awesome explaination !! Very clear

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว

      Glad it was helpful!

  • @manis8483
    @manis8483 3 ปีที่แล้ว +1

    Great flow of explanation. Loved it ❤️

  • @_ravi_kumar_gupta
    @_ravi_kumar_gupta 3 ปีที่แล้ว +8

    Great video. In extension to this can we get error handling, retry, rollback, transaction. It would be really helpful 🙏🙏🙏

  • @haohonglin466
    @haohonglin466 2 ปีที่แล้ว

    Thank you!!! Very useful tutorial!!

  • @kappaj01
    @kappaj01 3 ปีที่แล้ว +1

    Great stuff sir. Excellent video.

  • @skullwise
    @skullwise 3 ปีที่แล้ว +2

    great video, as always. One question, if we were to replace the Kafka producer(service 1) with Kafka cloud streams(just like the other 2 services), should we have to create a method that returns a Supplier of type Supplier
    Please confirm :)

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Nope. Supplier takes KStreams as input, it won't work for Producer. Kafka streams doesnt come at that microservice since there is no Kafka Stream usage at producer side

    • @skullwise
      @skullwise 3 ปีที่แล้ว

      @@TechPrimers thanks for your reply. Does that mean kafka streams can be used only when we wanna consume data? And that why we are not able use in the producer service?

  • @DhirenDash
    @DhirenDash 3 ปีที่แล้ว

    This was good. Although I am confused. Why would we use Kafka Streams for consuming a message? Should we not be using a normal consumer? Kafka Streams would be used only when we are consuming from and producing to a Kafka topic. Particularly useful when we need Exactly Once.

  • @lifesamazinginindia
    @lifesamazinginindia ปีที่แล้ว

    Hello, great tutorial. One question: Did we define consumer groups, how is it handled in ksp ?

  • @nicolaslopez-82
    @nicolaslopez-82 3 ปีที่แล้ว +1

    Very useful video! Thank you for your amazing work.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Glad it was helpful!

  • @tianyuli3015
    @tianyuli3015 2 ปีที่แล้ว +1

    Hi Ajay, would you mind explaining why you are using the spring kafka + spring cloud stream combination instead of the reactor kafka?

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว

      It's just for the ease of use. If we are using spring boot, the first obvious option is to try spring native libraries due to jar dependencies and their version maintenance.

  • @test-nature
    @test-nature 11 หลายเดือนก่อน +1

    Thank you very much

  • @ed.d8065
    @ed.d8065 2 ปีที่แล้ว

    thank you! but I have a curious question can you explain what you did on 8:30?

  • @vinodhreddy6227
    @vinodhreddy6227 3 ปีที่แล้ว +3

    Can you do one video for nats with complete end to endu message brocker

  • @ArjunKumar-zu2kl
    @ArjunKumar-zu2kl 3 ปีที่แล้ว +1

    Very nice explanation. What if we have so many Autowired classes then how can we replace it with Constructor Injection, do we need to keep adding those classes in class constructor, if yes then it will be too long when we have more classes autowired?

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +2

      If there are too many that means the class needs to be broken down

  • @riteshyt8170
    @riteshyt8170 2 ปีที่แล้ว +1

    Thanks a lot 😊👍

  • @teminoah2960
    @teminoah2960 3 ปีที่แล้ว +1

    awesome!!,
    great tutorial from a great teacher

  • @SaravanakrishnanPk
    @SaravanakrishnanPk 3 ปีที่แล้ว +1

    What's the tool that you used for creating arch visualization? It looks clean and nice.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Google slides

    • @SaravanakrishnanPk
      @SaravanakrishnanPk 3 ปีที่แล้ว

      @@TechPrimers Thanks, Can you share the google slide link (or download link) for this architecture diagram.

  • @omarkhalil4944
    @omarkhalil4944 ปีที่แล้ว

    Thank you very much!

  • @maixuandai
    @maixuandai 3 ปีที่แล้ว +1

    Very useful demo

  • @rashmiacharya4669
    @rashmiacharya4669 3 ปีที่แล้ว +1

    Nicely explained.

  • @rahuldeshmukh4662
    @rahuldeshmukh4662 3 ปีที่แล้ว

    Any example reference for spring cloud stream kafka binder producer which send stream to topic. As we don't have producer in kafka stream binder I need producer from Kafka binder to send data in key value pair.

  • @venkateshcharala2204
    @venkateshcharala2204 2 ปีที่แล้ว

    Great job.. Is there any video or source code link for same kafka cloud stream consumer class with retry and dead letter queue? If any can you please share with me.

  • @sanjaykantheti4002
    @sanjaykantheti4002 3 ปีที่แล้ว +1

    Hi Ajay, Very informative. As u already shown us kinesis so can u try an example using Google cloud dataflow??

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Sure will try soon sanjay

  • @aswarthanarayanareddyb176
    @aswarthanarayanareddyb176 3 ปีที่แล้ว +1

    Awsome content and great effort. Thank you so much Ajay. ♥️

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Thank you aswartha. Glad you liked it

  • @sanjeevprasadkotapati5783
    @sanjeevprasadkotapati5783 3 ปีที่แล้ว +1

    Thank you very much Ajay.i am a big fan of your content and this is one topic I have been looking for.is it possible to explain why we should use kafka streams when we can use traditional kafka consumers aka kafka listeners instead of kafka streams? Any advantage?

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Like any other framework/library, it's the ease of use for transforming data once it's consumed. Kstreams price rich SDK which helps in performing the transformation much simpler and readable

  • @jv88at17
    @jv88at17 3 ปีที่แล้ว

    Hi, Can you explain how you will handle exceptions as default behavior is FAIL if there is a exception while processing.

  • @cleyxds
    @cleyxds 3 ปีที่แล้ว

    it is possible to do this in a single project ?, instead of creating distinct projects for each cases. Thank you for the video.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      If you do this in a single project why do we need queues for interaction then?
      If you are referring to source code, that's upto you. You can have it in a single repo

  • @himanshubhatt9912
    @himanshubhatt9912 3 ปีที่แล้ว +1

    Hi Ajay can you make some videos examples like this one on hexagonal pattern.

  • @RealityCoupleVlogs
    @RealityCoupleVlogs 3 ปีที่แล้ว

    How to do error handling for publishing or consuming by using Kstreams

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Great question Palani. I will try making a video with examples

    • @RealityCoupleVlogs
      @RealityCoupleVlogs 3 ปีที่แล้ว

      @@TechPrimers Thank you..looking forward for ur video..! Would help for me to implement ... currently I m not using streams ..since don't know how to handle error

  • @acronis536
    @acronis536 3 ปีที่แล้ว

    how about a KTable example and a web controller serving requests from the KTable directly? :)

  • @ajit1105
    @ajit1105 3 ปีที่แล้ว

    Hi Ajay, how can we send the inactive domain to inactive topic. Do we need to streambridge

  • @debkr
    @debkr 2 ปีที่แล้ว

    Does kafka streams pull one message at a time from the topic?

  • @adhithyanms3
    @adhithyanms3 ปีที่แล้ว +1

    awesome

  • @ayyappag7097
    @ayyappag7097 2 ปีที่แล้ว +1

    excellent .. :)

  • @shaikfazeel6812
    @shaikfazeel6812 3 ปีที่แล้ว +1

    Hi... Just having a small doubt..
    In my project scenario.. For example if there is a Café where purchase transactions take place.. Any transactions, then they are immediately published using kafka.. Now suppose there are multiple different Cafés in different regions.... So in that case how much topics should I use and how shall I split the data based on different regions?and How do I design my kafka architecture using spring boot? Kindly provide ur answer..

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      If you are segregating by regions, you decided that data from one cafe region cannot be shared with another region, then you will need separate kafka topics and processes for consuming and persisting them

  • @RaveendraGuntupalli
    @RaveendraGuntupalli ปีที่แล้ว

    Awesome Thanks

  • @joemonta1702
    @joemonta1702 3 ปีที่แล้ว +1

    SUPER & Thanks...

  • @sandeshrana7225
    @sandeshrana7225 3 ปีที่แล้ว

    How can we trace the messages in this Kafka architecture using Spring Cloud Stream? I want to store every messages in my own database i.e. do not want to use Zipkin or Jaeger.

  • @pruthirajmohanty3520
    @pruthirajmohanty3520 2 ปีที่แล้ว

    Please create a video to address kafka stream with sleuth integration like standalone application which can pull the data and insert into DB

  • @sanjaykantheti4002
    @sanjaykantheti4002 3 ปีที่แล้ว

    Hi Ajay, Could you make a video on Kafka Connect and ksql db??

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Sure Sanjay. Will do

    • @sanjaykantheti4002
      @sanjaykantheti4002 3 ปีที่แล้ว

      @@TechPrimers Thanks Ajay for making a video on Kafka connect. It would be great if you could explain how to create custom connectors with a hands-on example & how to create custom transformers and use them in Kafka connect.

  • @subrahmanyagurumurthy5083
    @subrahmanyagurumurthy5083 3 ปีที่แล้ว +1

    Nice one thank you. But I think you hacked the Get method to perform some operation!

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Yes subbu. POCs are always hacked 🤓

  • @kunalsharma-zc2ho
    @kunalsharma-zc2ho 3 ปีที่แล้ว +2

    IntelliJ in action after a long period :)

  • @ILuvBilli
    @ILuvBilli 2 ปีที่แล้ว

    public domain API is not up

  • @gouravkumar-or6jy
    @gouravkumar-or6jy 2 ปีที่แล้ว

    This is a feedback bro, from next time before to show any demo related to spring please show its version because sometime we try to do but its deficult to create the same project at our end.

  • @craftsmanengineering
    @craftsmanengineering 3 ปีที่แล้ว +1

    Many thanks :)

  • @janamsoni3185
    @janamsoni3185 3 ปีที่แล้ว +1

    Hey bro, i have added Cachable Static Assets with Spring MVC, but now i want to give button to user by which he can clear cache of website

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Get the CacheManager instance and your cache from it and clear(). Take reference here stackoverflow.com/questions/56458748/reload-refresh-cache-in-spring-boot

    • @JaNaMSoNi
      @JaNaMSoNi 3 ปีที่แล้ว

      Are you sure it'll work with MVC ?
      Because here I'm talking about static resources browser's caching

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Oh you mean the images and stuff. That will not work with the above solution. You need to clean up your storages in the client side via react/angular whichever you use

  • @DevOpsConnect
    @DevOpsConnect 2 ปีที่แล้ว

    Kafka streams cannot deserialized if there are two processor are active how to fix this ??

  • @Virat77799
    @Virat77799 3 ปีที่แล้ว +1

    Also my other question: in crawler you said you could use kstreams, how can kstreams read data apart from topic ( kstreams reads data to and from topic)
    Pls provide any example if kstreams could read from different source
    Correct me if my question are wrong ❌

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Nope. Crawler doesnt read from kstreams. It can't use kstreams. Kstreams is a kafka dependant library from Kafka. Only processor n service uses kstreams

    • @Virat77799
      @Virat77799 3 ปีที่แล้ว

      So the value what you get after possessing the data could be saved in db right

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +1

      Yes you are right

    • @Virat77799
      @Virat77799 3 ปีที่แล้ว

      However with plain kstream apis saving to db is not possible, and spring kafka streams is solution. Am I right?

  • @aqibishaq885
    @aqibishaq885 3 ปีที่แล้ว +1

    Sir one video for play framework of java please

  • @benedictdixon4622
    @benedictdixon4622 3 ปีที่แล้ว

    I keep getting the following on the processor?
    The class '[B' is not in the trusted packages:
    Any ideas? The consumer config also never seems to get the deserializer to be the one specified in the config (JsonDeserializer), so I think it is because of this?
    value.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Yes. Serialization is the key Benny. I had faced similar issues while trying it out before recording the video. You hav to Serialize and deserialize with same library

    • @benedictdixon4622
      @benedictdixon4622 3 ปีที่แล้ว

      @@TechPrimers I believe I am? I am using the same Serializer and Deserializer that you are specifying in your application.yml files? It is just not picking them up to be used and so it is falling back on the ByteArrayDeserializer?

  • @Virat77799
    @Virat77799 3 ปีที่แล้ว

    How do you save the data on consumer side to DB? In kstreams it's not possible right. Kstreams is all about topic to topic
    If so can you tell us the way to save data to db?

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      You have to leverage spring jpa or traditional way of storing to DB. But you can hook those methods into the kstream consumer like any other class implementation

  • @pitchireddyb646
    @pitchireddyb646 3 ปีที่แล้ว +1

    ❤️❤️❤️

  • @JaNaMSoNi
    @JaNaMSoNi 3 ปีที่แล้ว +1

    Intro ❤️

  • @digisecureagent7679
    @digisecureagent7679 3 ปีที่แล้ว +1

    Another point, don't use same domain. Microservices should be independent. If same domain changes it forces all of the other depended models to apply changes and this blocks the whole product build pipeline.

  • @lenguyenkhoik14dn72
    @lenguyenkhoik14dn72 2 ปีที่แล้ว

    Do you publish this repo on your github guys ?

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว

      Yes. The link is in the description

  • @cinemaworld7931
    @cinemaworld7931 3 ปีที่แล้ว

    Use white color for your background bro

  • @manindersingh6371
    @manindersingh6371 2 ปีที่แล้ว

    Thanks for making the video. Kindly choose those website who is active in world-wide. Trying to use your domain Website to access the domain but this website is not working in Canada. Anyway content was fine. Thank you

    • @manindersingh6371
      @manindersingh6371 2 ปีที่แล้ว

      and also share the proper link of branch in Github. Your github link was for home page of github.

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว +1

      Did not notice the missing link Maninder. Thanks for notifying. I have updated the github code in the description. here is link for Github code: github.com/TechPrimers/kafka-streams-microservices-example

  • @saranyarupini5932
    @saranyarupini5932 3 ปีที่แล้ว

    Awesome work 👍🏻 Could you please try playing with multiple streams like configuring, merging, joining, processing etc? Because i had issue after merging 2 KStreams, records weren't flown to processor.
    cdcStreams.merge(edcStreams).process((ProcessorSupplier) () -> new CCCPStreamProcessor(config, esRepo),
    ConstantUtils.CCCP);

  • @ishanisarkar8854
    @ishanisarkar8854 3 ปีที่แล้ว +1

    ❤️❤️