Saga Design pattern Spring Boot Microservices Interview Questions and Answers | Code Decode

Поділитися
Вставка
  • Опубліковано 15 лис 2022
  • In this video of code decode we have explained saga design pattern in Spring boot microservices.
    Udemy Course of Code Decode on Microservice k8s AWS CICD link:
    openinapp.co/udemycourse
    Course Description Video :
    yt.openinapp.co/dmjvd
    Why SAGA ??
    We know that Design pattern gives solutions to common problems faced by us “THE DEVELOPERS”. So What problem is solved by this SAGA design pattern ?
    The problem started as soon as we moved from Monolithic application to Microservice Architecture.
    We will take example of Swiggy , zomato.
    You
    Choose your dishes,
    Add them to Cart and checkout
    Make Payment
    Order gets Delivered
    Our order is marked as completed after delivery is successful.
    In monolithic it’s not a problem as we have 1 database , multiple Tables like Orders, Payments, Delivery Etc. Now in 1 Single Atomic transaction we can do all these steps and if payment fails, everything gets rolled back.
    Now we moved to microservices architecture and Segregated the whole zomato or swiggy application to
    Order service
    Payment service
    Delivery Service
    Now your order service accepts your order, Payment service validates the payment done and Delivery service is responsible for delivery of your order to your home. When delivered successfully the orders is marked completed in the application. This is happy case.
    Ever thought about the worst case Delivery is failed as no delivery partner was available. Your payment was done, Money got deducted and now No food. At Least we need to get the money back and Order must be marked as cancelled.
    For this to happen we need a Transaction rollback . Transaction did get rolled back but only the scope of transaction was in Delivery service. The boundary for this transaction ended in Delivery service.
    Ways to Implement SAGA?
    There are two type of saga implementation ways
    choreography
    orchestration
    What is Choreography Saga Pattern?
    Choreography is a way to coordinate sagas where participants exchange events without a centralized point of control
    With choreography, each microservices run its own local transaction and publishes events to message broker system and that trigger local transactions in other microservices.
    Advantages of Choreography Saga Pattern?
    Good for simple workflows that require few participants and don't need a coordination logic
    Doesn't require additional service implementation and maintenance.
    Doesn't introduce a single point of failure, since the responsibilities are distributed across the saga participants.
    Disadvantages of Choreography Saga Design Pattern?
    Workflow can become confusing when adding new steps, as it's difficult to track which saga participants listen to which commands.
    There's a risk of cyclic dependency between saga participants because they have to consume each other's commands
    What is Orchestration Saga Pattern?
    Orchestration is a way to coordinate sagas where a centralized controller tells the saga participants what local transactions to execute.
    The saga orchestrator handles all the transactions and tells the participants which operation to perform based on events.
    Advantages of Orchestration Saga Pattern?
    Good for complex workflows involving many participants or new participants added over time.
    Suitable when there is control over every participant in the process, and control over the flow of activities.
    Doesn't introduce cyclic dependencies, because the orchestrator unilaterally depends on the saga participants.
    Saga participants don't need to know about commands for other participants. Clear separation of concerns simplifies business logic.
    Disadvantages of Orchestration Saga Pattern?
    Additional design complexity requires an implementation of a coordination logic.
    There's an additional point of failure, because the orchestrator manages the complete workflow
    Most Asked Core Java Interview Questions and Answers: • Core Java frequently a...
    Advance Java Interview Questions and Answers: • Advance Java Interview...
    Java 8 Interview Questions and Answers: • Java 8 Interview Quest...
    Hibernate Interview Questions and Answers:
    • Hibernate Interview Qu...
    Spring Boot Interview Questions and Answers:
    • Advance Java Interview...
    Angular Playlist: • Angular Course Introdu...
    SQL Playlist: • SQL Interview Question...
    GIT: • GIT
    Subscriber and Follow Code Decode
    Subscriber Code Decode: ua-cam.com/users/CodeDecode?...
    LinkedIn : / codedecodeyoutube
    Instagram: / codedecode25
    #sagadesingpattern #interviewquestions #codedecode

КОМЕНТАРІ • 134

  • @balag2368
    @balag2368 Рік тому +48

    Got many offers just in ten days. Your playlist is enough to clear any interviews.

    • @CodeDecode
      @CodeDecode  Рік тому +7

      Many congratulations Bala 👏👏👏👏. Well done . Keep learning keep shining Man 👍👍👍

    • @hackstreet781
      @hackstreet781 11 місяців тому +4

      absolutely. I also got 2 offers.

    • @kartiksachdeva4196
      @kartiksachdeva4196 5 місяців тому

      Which companies

    • @ysatyadivy
      @ysatyadivy 4 місяці тому

      Do you have experience before in JAVA or did you try as a fresher?

    • @kartiksachdeva4196
      @kartiksachdeva4196 4 місяці тому

      ​@@ysatyadivy If u need any help u can ping me i have 8yoe

  • @sukanyaswaminathan9130
    @sukanyaswaminathan9130 18 днів тому +1

    Thanks a lot.. i am in maternity break for the past 4 years.. And bcos of code decode i was able to clear many interviews.. You are really doing a great job. God bless u all❤

  •  Рік тому +7

    Awsome channel ma'am! You are clearing up all the concepts in half an hour or less, keep up the great work!

  • @abdulmaliknurudeen7331
    @abdulmaliknurudeen7331 10 місяців тому +2

    I have read alot about microservices. But this playlist Sums everything up. Thanks alot.

    • @CodeDecode
      @CodeDecode  10 місяців тому

      Good to hear that Man 👍👍😊

  • @sreejeshraj4800
    @sreejeshraj4800 Рік тому +2

    Nice explanation and illustration, without wasting time. Great job!

  • @thiyamybabygirl2144
    @thiyamybabygirl2144 Рік тому +4

    Thanks for this video. Expected one.... first like...

    • @CodeDecode
      @CodeDecode  Рік тому +2

      Thanks a lot 🙂🙂👍👍

  • @razvan-danielmihaescu1555
    @razvan-danielmihaescu1555 Рік тому +4

    Very nice video, started some months ago on a microservices architecture project. This video offered me another view of my proiect as well. Many thanks, really looking forward for the next ones!
    Many congratulations! Very good job, maybe an improvement could be also some more examples from the real world while explaining all of the concepts could help to understand everything better, like Kafka could be a good example in this video for instance which you already mentioned.

    • @CodeDecode
      @CodeDecode  Рік тому +1

      Thanks. Sure👍👍 we will cover more real time examples👍

  • @manojkumarpadhi2445
    @manojkumarpadhi2445 Рік тому +2

    Thanks a lot for such a brief explanation. I was waiting for it from a long time back...😊👌👍

  • @mohammedsufi4649
    @mohammedsufi4649 5 місяців тому +1

    Please keep up your great job!.. All your materials are not only for interview it helps us to enhance and improve our overall technical knowledge in a concise way. Hats off to all your efforts!..

  • @AshishSingh-rx4sq
    @AshishSingh-rx4sq Рік тому +1

    Superb! Every time I study learn from here, I feel lucky to discover this channel. This channel will surely cling the #1 best channel one day.

    • @CodeDecode
      @CodeDecode  Рік тому

      Means a lot to us Ashish 🙏🙏

  • @kalpanapeddi5754
    @kalpanapeddi5754 23 дні тому

    Lots of respect to u sister❤If any interview was scheduled, i will just go through all the playlists which helps me alot to crack the interviews😍

  • @sajeeshkumar4510
    @sajeeshkumar4510 Рік тому +1

    Nice and able to understand with more clarity. Thanks for your video.🙏

    • @CodeDecode
      @CodeDecode  Рік тому

      Thanks Sajeesh 🙂🙂👍👍

  • @sonujain4768
    @sonujain4768 7 місяців тому +3

    Helped me to understand the topic quite easily. Great job! 👍😀

    • @CodeDecode
      @CodeDecode  7 місяців тому +1

      Thanks Sonu 😊❤️

  • @user-gw2fc6bf4f
    @user-gw2fc6bf4f 3 місяці тому

    this video is not for learning , but getting the entire concept clear in just 20 mins.

  • @truthreveal6521
    @truthreveal6521 Рік тому +2

    Got to know today about your channel . I found its v helpful. I have started going through ur Playlist, its v good for today's market 👌. N ur way explanation is awesome.
    It would would very helpful if you do a simple project on this saga please . I was asked in recent interviews

    • @CodeDecode
      @CodeDecode  Рік тому

      Thanks a lot 🙂🙂. Sure we will do that 👍👍

  • @user-fc7th5rw1z
    @user-fc7th5rw1z 4 місяці тому +1

    Several thanks to you madam. After listening to your vodcast, I think I must be able to crack one interview. You must be well trained tutor

    • @CodeDecode
      @CodeDecode  4 місяці тому

      Thanks 😊😊 many congratulations on cracking your interviews 👍👍

  • @shilpasingla1739
    @shilpasingla1739 10 днів тому

    Awesome explanation of saga pattern

  • @manoj47parmar
    @manoj47parmar Рік тому +2

    Just 1/2hr ago it was asked in interview. Thanks for sharing this wonderful video🤩✌

    • @CodeDecode
      @CodeDecode  Рік тому

      Thanks Manoj. M sure things will settle up soon 👍👍

    • @manoj47parmar
      @manoj47parmar Рік тому +1

      @@CodeDecode Ya one day definitely with the support of #CodeDecode

    • @CodeDecode
      @CodeDecode  Рік тому

      👍👍keep rocking Manoj 👍👍

  • @abhishekgowlikar
    @abhishekgowlikar 6 місяців тому +1

    Good content on the MS Design Patterns.

  • @rslakshmicreation
    @rslakshmicreation Рік тому

    Hi am using undertow-core dependency in my springboot project. Jfrog is not showing any fix version. And xray violation is showing in jenkins. Pls help to solve undertow vulnerability issue. Pls suggests some solution. Thanks in advance

  • @jayjoshi1366
    @jayjoshi1366 6 місяців тому

    Awesome explanation on Saga Design Pattern and its two types. I just have one question regarding the Drawback of Orchestration Pattern : Since it is a single point of failure and if it's down then no service can communicate with each other to let next participant know of executing its process, is there any solution to this drawback? And if not, then is Orchestration Pattern worth using in Microservices architecture where there can be hundreds to thousands of microservices ?
    Your answer on this would be really appreciated. Thanks!

  • @hackstreet781
    @hackstreet781 11 місяців тому +1

    I was asked about Saga pattern in an interview but I was not aware about it, now in 20 minutes, I know what it is about. Thank you very much and keep making such videos. Can you also cover Jenkins in some video?

    • @CodeDecode
      @CodeDecode  10 місяців тому

      Thanks. Please participate in our give away Man also let us know your name. You have been our constant supporter. We would love to pay you back. Please add your email n name in the form we shared today in the video.

  • @Atul_Shegokar
    @Atul_Shegokar Рік тому +2

    Excellent explanation Ma'am, I loved the way you explain with real time example.
    Can you please also describe Chreography and orchestration with coding examples?

  • @shankark1664
    @shankark1664 6 місяців тому

    very very nice and clear explanation madam. thank you for your videos

    • @CodeDecode
      @CodeDecode  5 місяців тому

      you are welcome shankar

  • @santhoshr2497
    @santhoshr2497 3 місяці тому +1

    Hey thank you for making such great videos.. please make videos for other three types of design patterns

  • @zmxn007
    @zmxn007 9 місяців тому +1

    Very good explanation. thannks

  • @krishnalakshmi8896
    @krishnalakshmi8896 10 місяців тому +1

    hi , this video is truely very good , please try making videos of CQRS and other design patterns of Microservices. Thanks

    • @CodeDecode
      @CodeDecode  9 місяців тому

      Sure we will try to upload that video soon 👍

  • @dummymail6029
    @dummymail6029 3 місяці тому +1

    great video thanks code decode

  • @MohitKhare
    @MohitKhare Рік тому +1

    amazingly explained. ❤

  • @layarichard6739
    @layarichard6739 Рік тому +1

    Thank you very much..pls add videos for other patterns also

  • @phanimc11211
    @phanimc11211 Рік тому +1

    Can you please also describe Chreography and orchestration with coding examples, TIA

  • @vidhyavd8385
    @vidhyavd8385 Рік тому +2

    Hello Mam, You are doing an awesome job helping many people out there with clarity.
    Can you please do a video on J2EE design patterns

    • @CodeDecode
      @CodeDecode  Рік тому

      ua-cam.com/play/PLyHJZXNdCXselvpjEhygQ9GlDQihtQj6i.html

    • @CodeDecode
      @CodeDecode  Рік тому

      Thanks a lot Vidhya👍👍🙂🙂

  • @rajenderprasad1193
    @rajenderprasad1193 Рік тому +1

    Thank you very much .. 😊

  • @srndrpec
    @srndrpec Рік тому +1

    Hi, I have a doubt, what if we're designing for Flight Tickets booking
    with 2 services booking and payment service,
    If we use Saga, booking will reduces #AvailableTickets count and then goes to payment service.
    Take a look at this Scenario:
    a. 2 requests Came into system and only 1 ticket left to book
    b. As per Saga, first request reduced #AvailableTickets to 0 and went ahead to payment service
    c. Meanwhile second request entered booking service and saw no tickets available and returns.
    d. first request failed at payment and rolled back #AvailableTickets to 1
    So Saga supports only eventual consistency?

  • @arpanagrawal4264
    @arpanagrawal4264 Рік тому +1

    Very nicely explained. Hats off!! Pls create a video for CQRS design pattern as well.

  • @komalsingh-vi2ur
    @komalsingh-vi2ur Рік тому +3

    Hi,This is really helpful. Can you please also describe Chreography and orchestration with coding examples?

  • @akashsaha9366
    @akashsaha9366 Рік тому +1

    Thanks maam. Good one

  • @karthiknainupatruni5022
    @karthiknainupatruni5022 Рік тому

    please make a video for CQRS and Event sourcing Design patterns

  • @AshishAshish-fp8po
    @AshishAshish-fp8po Місяць тому

    One Question - You said while delivery fail, will call the revert payment event so payment service had done the commit already right ? and then payment service will rollback the committed transaction ? or it will do reverse credit the amount to customer ?
    please answer

  • @PolaSantosh27
    @PolaSantosh27 Рік тому +1

    Hi, It was a wonderful explanation of the SAGA pattern👌👏👏. Considering the same example which you gave us, can you make a spring-boot coding example, which shows us how this is implemented in real-time? Please provide me the link if you have already done a video for that. Thanks in advance

    • @bhavanadurga
      @bhavanadurga Рік тому +1

      Same request from my side as well

  • @PujaKumari-rp5sg
    @PujaKumari-rp5sg 21 день тому

    Same question asked in one of my interview

  • @gokulaher2476
    @gokulaher2476 3 місяці тому

    Hi this is gokul here
    Its been long time it's nice explanation about saga
    Could you please create a video of the real code example of the same UI micro service
    Order microservice, payment microservice, delivery microservice
    That would be really good
    Thanks for the informative video

  • @ruchajoshi1517
    @ruchajoshi1517 Рік тому +1

    Well explained

  • @rishiraj2548
    @rishiraj2548 Рік тому +1

    👍💯

  • @tysonnfury9226
    @tysonnfury9226 Рік тому +1

    Thankyou dear

  • @omprakash-vq3wq
    @omprakash-vq3wq Рік тому +1

    Good explanation, can you please add CQRS design patterns video with example?

  • @sivashankar-sx9ul
    @sivashankar-sx9ul 6 місяців тому +1

    Super akka

  • @tysonnfury9226
    @tysonnfury9226 Рік тому

    Can you explain what is the difference between this transaction communication and microservices communication.

  • @lovebranch-hemavasanth
    @lovebranch-hemavasanth Рік тому

    what is interceptor and how to create own interceptor in microservices ? and one more thing how to implement saga approach

  • @na2599
    @na2599 3 місяці тому

    Orchestration Pattern is the Synchronous Communication right?

  • @jayakrishnathammana
    @jayakrishnathammana Рік тому +1

    Please do a series of design patterns and their use in micro services…

  • @hamednikbakht9708
    @hamednikbakht9708 Рік тому +3

    please add video from spring batch process excel file microservice

  • @anandu06
    @anandu06 Рік тому +1

    Please add example for the above concept , as per theory able to understand but if u added the coding part ,it will be wonderful.

  • @sreejeshraj4800
    @sreejeshraj4800 Рік тому +1

    Can you please create videos for other design patterns too? Thanks in advance.

    • @CodeDecode
      @CodeDecode  Рік тому

      Sure 👍👍 we will do that 👍

  • @devendra.sanghavi
    @devendra.sanghavi Місяць тому

    ♥♥

  • @bhavanadurga
    @bhavanadurga Рік тому +1

    Can you pls implement Spring boot application of it

  • @sona7806
    @sona7806 Рік тому +1

    Thanks for the content. Please create other design pattern videos like CQRS

  • @jasonsgreen
    @jasonsgreen 8 місяців тому

    i have no clue on what swiggy or zomato sounds like uber or grub hub ?

  • @mallesrao
    @mallesrao Рік тому +1

    Can we have any implementation for Saga... which is good to work with Distributed tx

  • @arpitsik4649
    @arpitsik4649 Рік тому +1

    Hi Mam, Hope you are doing good. I need a small suggestion.
    In one of recent interviews, i was asked how you maintain transaction in microservice applications. I mentioned exactly the same saga design pattern.
    Just next to that i got a ques, how have u implemented the saga pattern in the project realtime?
    How to answer this question. Any siggestion would be great or else if any realtime implementation video would be there it would be much more helpful. ThankYou💯

    • @CodeDecode
      @CodeDecode  Рік тому

      There are 2 ways Arpit - 1) orchestrator 2) choreography
      That's how u implement it. Is it not covered in video Arpit?? Did I forget to mention it???

    • @arpitsik4649
      @arpitsik4649 Рік тому +1

      @@CodeDecode No no mam , you have mentioned both the points in the video.
      It was asked how you have implemented that specific choreography in your project.
      May be implementTion part they want to know. That was my concern.
      Can we describe the kafka implementTion in answer to the same question

    • @CodeDecode
      @CodeDecode  Рік тому

      Ohh ok implementation is left. Correct Arpit . I completely forgot about that. Thanks a lot for reminder. We will try to upload implementation part 👍👍😇. Thanks 🙂🙂

    • @arpitsik4649
      @arpitsik4649 Рік тому

      @@CodeDecode thank you so much mam. Eagerly waiting for the implementation video. Coz I lost one interview just bcz for this implementation part.
      As I always say, you are doing a way better for us. Keep going mam.✨️

    • @sajalmathur6003
      @sajalmathur6003 Рік тому

      @@CodeDecode Waiting for implementation part and cqrs pattern. Please continue your microservice series as it will help everyone to upskill with your way of teaching with practical examples as theortical sessions are few only

  • @user-ll6gt2nd9q
    @user-ll6gt2nd9q 4 місяці тому

    If orchestration itself has its own problems then what is the solution?

  • @anandnerurkar4471
    @anandnerurkar4471 Рік тому +1

    very nice video. is it possible for you to take CQRS, EVENT SOURCING

  • @vandanac2244
    @vandanac2244 10 місяців тому +1

    Please can u add videos for CQRS pattern

  • @ArjunKumar-zu2kl
    @ArjunKumar-zu2kl Рік тому

    Good one though but this video title is misleading saying interview question, it's SAGA tutorial only.

  • @ankeshkapil3129
    @ankeshkapil3129 Місяць тому

    how come create and validate and send order happen in one transaction 😅

  • @dhirajbindal7539
    @dhirajbindal7539 Рік тому

    Hello Mam
    I am searching for a Java job as a fresher and I am bit worried.
    Please guide me which topics should I learn from your videos ??

  • @shilpasah3388
    @shilpasah3388 Рік тому +1

    Please show example for saga pattern .

  • @PrateekJain348
    @PrateekJain348 Рік тому +1

    I have a set of questions on Microservices, could you please help me with them?

    • @CodeDecode
      @CodeDecode  Рік тому

      Sure Prateek. Shoot👍

    • @PrateekJain348
      @PrateekJain348 Рік тому

      @@CodeDecode Below is the list of Questions.
      - Circuit breaker pattern in Microservices?
      - Constructor overloading with reference to Dependency injection?
      - We have a Json file and 2 microservices , 1st one is putting data in this JSON file and 2nd one is consuming data from this. How will you handle locking of the file?
      - Can we use SAGA to resolve distributed locking system?
      - Will SAGA help in case we read Json file for put and consume case?
      - What will heppen when we use POST to update the Data?
      - There might be a change PUT won't work, can we use POST in that case?
      - Application is incapable of processing PUT, Can we use POST to update data in Database ?
      - Advantage/Disadvantage of using post to update Data?
      - Distributed Locks in Spring-boot Microservice Environment?

  • @abdullahzthought
    @abdullahzthought 8 днів тому +1

    What is the full form of SAGA?

    • @CodeDecode
      @CodeDecode  7 днів тому

      SAGA" does not stand for an acronym but is borrowed from storytelling, symbolizing a sequence of events that make up a complete narrative

  • @indlasubramanyam8766
    @indlasubramanyam8766 Рік тому +1

    Your money got deducted and you have no food 😁😁😁😁 3:36

  • @rakeshmishraLmp
    @rakeshmishraLmp 8 місяців тому

    There is much English rather than facts and knowledge

  • @Satenc0
    @Satenc0 11 місяців тому

    One question, using the orchestrator, is the orchestrator microservice required to have its own database too?

  • @iammanishvb7332
    @iammanishvb7332 Рік тому +1

    Nicely explained 🫡
    Can you make a demo for this one?