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

Sdílet
Vložit
  • čas přidán 6. 05. 2021
  • This video covers how to leverage Kafka Streams using Spring Cloud stream by creating multiple spring boot microservices
    📌 Related Links
    =============
    🔗 Github code: github.com/TechPrimers/kafka-...
    🔗 Kafka setup: docs.confluent.io/platform/cu...
    🔗 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/JoinTechPrimers
    💥 Telegram: t.me/TechPrimers
    💥 TechPrimer HindSight (Blog): / techprimers
    💥 Website: techprimers.com
    💥 Slack Community: techprimers.slack.com
    💥 Twitter: / techprimers
    💥 Facebook: TechPrimers
    💥 GitHub: github.com/TechPrimers or techprimers.github.io/
    🎬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
  • Jak na to + styl

Komentáře • 141

  • @williandougherty6674
    @williandougherty6674 Před 3 lety +4

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

  • @ljka
    @ljka Před 3 lety +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.

  • @manis8483
    @manis8483 Před 3 lety +1

    Great flow of explanation. Loved it ❤️

  • @panndey
    @panndey Před 3 lety

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

  • @diogennesthesinope61
    @diogennesthesinope61 Před 2 lety +2

    Never seen this explained so clearly. Great job!

  • @SandeshReddy
    @SandeshReddy Před 3 lety +1

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

  • @PrashantZombade
    @PrashantZombade Před rokem +1

    Nicely explained, thanks for such a great tutorial!

  • @reachkrishnaraj
    @reachkrishnaraj Před 2 lety

    Another concise and helpful AV. Appreciate it, buddy.

  • @ankitjain6437
    @ankitjain6437 Před 3 lety +1

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

  • @teminoah2960
    @teminoah2960 Před 3 lety +1

    awesome!!,
    great tutorial from a great teacher

  • @jaineshmodi
    @jaineshmodi Před 3 lety

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

  • @cheshvikaraj7769
    @cheshvikaraj7769 Před rokem +2

    nice explanation. Thank you

  • @SaiKumar-vf9lz
    @SaiKumar-vf9lz Před 3 lety +1

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

    • @TechPrimers
      @TechPrimers  Před 3 lety +1

      You too stay Safe Sai. Thank you👍

  • @JameS00989
    @JameS00989 Před 3 lety +1

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

  • @melwin-dmello-dev
    @melwin-dmello-dev Před rokem +1

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

  • @udit9337
    @udit9337 Před 2 lety +1

    Excellent Kafka tutorial thanks

  • @aswarthanarayanareddyb176

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

    • @TechPrimers
      @TechPrimers  Před 3 lety

      Thank you aswartha. Glad you liked it

  • @haohonglin466
    @haohonglin466 Před rokem

    Thank you!!! Very useful tutorial!!

  • @kappaj01
    @kappaj01 Před 2 lety +1

    Great stuff sir. Excellent video.

  • @nicolaslopez-82
    @nicolaslopez-82 Před 3 lety +1

    Very useful video! Thank you for your amazing work.

  • @kylemarcus1152
    @kylemarcus1152 Před 2 lety +1

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

  • @rashmiacharya4669
    @rashmiacharya4669 Před 3 lety +1

    Nicely explained.

  • @daccu8633
    @daccu8633 Před 2 lety +1

    thanks a lot. it is very helpful for kafka beginner

  • @balachandran7777
    @balachandran7777 Před 2 lety +1

    Really liked it. Great efforts made for clear understanding.

  • @riteshsingh1245
    @riteshsingh1245 Před 2 lety +1

    Very Nice tutorial for Kafka Streams

  • @omarkhalil4944
    @omarkhalil4944 Před rokem

    Thank you very much!

  • @maixuandai
    @maixuandai Před 3 lety +1

    Very useful demo

  • @maheswarbehera1
    @maheswarbehera1 Před 2 lety +1

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

  • @dheereshsingh6415
    @dheereshsingh6415 Před 4 měsíci +1

    tremendous effort to make this stuff so good and understandable

  • @allaboutmusicanddance5108

    Great tutorial thankyou 🧿

  • @narendrakumariitb
    @narendrakumariitb Před 2 lety +1

    Thank you for such an easy explanation 🙏

  • @anandhnarendra9230
    @anandhnarendra9230 Před 2 lety +1

    Awesome explaination !! Very clear

  • @siddheshlatkar2165
    @siddheshlatkar2165 Před rokem +1

    Great tutorial. Thanks!

  • @rakeshroshan829
    @rakeshroshan829 Před 2 lety +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 ..

  • @craftsmanengineering
    @craftsmanengineering Před 3 lety +1

    Many thanks :)

  • @joemonta1702
    @joemonta1702 Před 3 lety +1

    SUPER & Thanks...

  • @arungore6578
    @arungore6578 Před 3 lety

    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 ?

  • @maddipatlamadhura1500
    @maddipatlamadhura1500 Před 8 měsíci +1

    Thank you very much

  • @riteshyt8170
    @riteshyt8170 Před 2 lety +1

    Thanks a lot 😊👍

  • @RaveendraGuntupalli
    @RaveendraGuntupalli Před rokem

    Awesome Thanks

  • @cultOfApple
    @cultOfApple Před rokem +1

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

  • @ambarishkapil8004
    @ambarishkapil8004 Před 2 měsíci +1

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

  • @adhithyanms3
    @adhithyanms3 Před rokem +1

    awesome

  • @ayyappag7097
    @ayyappag7097 Před 2 lety +1

    excellent .. :)

  • @lifesamazinginindia
    @lifesamazinginindia Před rokem

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

  • @manognajoshik8465
    @manognajoshik8465 Před rokem +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.

  • @vinodhreddy6227
    @vinodhreddy6227 Před 3 lety +3

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

  • @jcrshankar
    @jcrshankar Před 3 lety +1

    Good one buddy.. please add error/exception handling

  • @balajiarumugam1876
    @balajiarumugam1876 Před 2 lety

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

  • @jv88at17
    @jv88at17 Před 2 lety

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

  • @ed.d8065
    @ed.d8065 Před 2 lety

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

  • @sanjeevprasadkotapati5783

    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  Před 3 lety

      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

  • @JaNaMSoNi
    @JaNaMSoNi Před 3 lety +1

    Intro ❤️

  • @RealityCoupleVlogs
    @RealityCoupleVlogs Před 3 lety

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

    • @TechPrimers
      @TechPrimers  Před 3 lety +1

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

    • @RealityCoupleVlogs
      @RealityCoupleVlogs Před 3 lety

      @@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 Před 3 lety

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

  • @ajit1105
    @ajit1105 Před 2 lety

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

  • @pitchireddyb646
    @pitchireddyb646 Před 3 lety +1

    ❤️❤️❤️

  • @_ravi_kumar_gupta
    @_ravi_kumar_gupta Před 3 lety +8

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

  • @ishanisarkar8854
    @ishanisarkar8854 Před 3 lety +1

    ❤️❤️

  • @rahuldeshmukh4662
    @rahuldeshmukh4662 Před 2 lety

    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.

  • @dheerajsachan5808
    @dheerajsachan5808 Před rokem

    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.

  • @venkateshcharala2204
    @venkateshcharala2204 Před 2 lety

    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.

  • @DhirenDash
    @DhirenDash Před 3 lety

    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.

  • @skullwise
    @skullwise Před 3 lety +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  Před 3 lety +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 Před 3 lety

      @@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?

  • @alfred.g
    @alfred.g Před 2 lety +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  Před 2 lety +1

      You can add a Spring interceptor to log those.

  • @ArjunKumar-zu2kl
    @ArjunKumar-zu2kl Před 3 lety +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  Před 3 lety +2

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

  • @debkr
    @debkr Před rokem

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

  • @sandeshrana7225
    @sandeshrana7225 Před 2 lety

    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.

  • @sanjaykantheti4002
    @sanjaykantheti4002 Před 3 lety +1

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

  • @tianyuli3015
    @tianyuli3015 Před 2 lety +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  Před 2 lety

      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.

  • @kunalsharma-zc2ho
    @kunalsharma-zc2ho Před 3 lety +2

    IntelliJ in action after a long period :)

  • @DevOpsConnect
    @DevOpsConnect Před 2 lety

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

  • @aqibishaq885
    @aqibishaq885 Před 3 lety +1

    Sir one video for play framework of java please

  • @himanshubhatt9912
    @himanshubhatt9912 Před 3 lety +1

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

  • @ILuvBilli
    @ILuvBilli Před 2 lety

    public domain API is not up

  • @pruthirajmohanty3520
    @pruthirajmohanty3520 Před 2 lety

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

  • @SaravanakrishnanPk
    @SaravanakrishnanPk Před 3 lety +1

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

    • @TechPrimers
      @TechPrimers  Před 3 lety

      Google slides

    • @SaravanakrishnanPk
      @SaravanakrishnanPk Před 3 lety

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

  • @shaikfazeel6812
    @shaikfazeel6812 Před 3 lety +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  Před 3 lety +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

  • @janamsoni3185
    @janamsoni3185 Před 3 lety +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  Před 3 lety

      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 Před 3 lety

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

    • @TechPrimers
      @TechPrimers  Před 3 lety

      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

  • @cleyxds7112
    @cleyxds7112 Před 3 lety

    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  Před 3 lety

      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

  • @gouravkumar-or6jy
    @gouravkumar-or6jy Před 2 lety

    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.

  • @Virat77799
    @Virat77799 Před 3 lety

    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  Před 3 lety

      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

  • @benedictdixon4622
    @benedictdixon4622 Před 3 lety

    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  Před 3 lety

      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 Před 3 lety

      @@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?

  • @sanjaykantheti4002
    @sanjaykantheti4002 Před 2 lety

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

    • @TechPrimers
      @TechPrimers  Před 2 lety +1

      Sure Sanjay. Will do

    • @sanjaykantheti4002
      @sanjaykantheti4002 Před 2 lety

      @@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

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

    • @TechPrimers
      @TechPrimers  Před 3 lety +1

      Yes subbu. POCs are always hacked 🤓

  • @lenguyenkhoik14dn72
    @lenguyenkhoik14dn72 Před 2 lety

    Do you publish this repo on your github guys ?

  • @cinemaworld7931
    @cinemaworld7931 Před 3 lety

    Use white color for your background bro

  • @Virat77799
    @Virat77799 Před 3 lety +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  Před 3 lety +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 Před 3 lety

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

    • @TechPrimers
      @TechPrimers  Před 3 lety +1

      Yes you are right

    • @Virat77799
      @Virat77799 Před 3 lety

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

  • @digisecureagent7679
    @digisecureagent7679 Před 3 lety +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.

  • @saranyarupini5932
    @saranyarupini5932 Před 3 lety

    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);

  • @manindersingh6371
    @manindersingh6371 Před 2 lety

    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 Před 2 lety

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

    • @TechPrimers
      @TechPrimers  Před 2 lety +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