Saga Design pattern Spring Boot Microservices Interview Questions and Answers | Code Decode
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: kzhead.info?...
LinkedIn : / codedecodeyoutube
Instagram: / codedecode25
#sagadesingpattern #interviewquestions #codedecode
Got many offers just in ten days. Your playlist is enough to clear any interviews.
Many congratulations Bala 👏👏👏👏. Well done . Keep learning keep shining Man 👍👍👍
absolutely. I also got 2 offers.
Which companies
Do you have experience before in JAVA or did you try as a fresher?
@@ysatyadivy If u need any help u can ping me i have 8yoe
Awsome channel ma'am! You are clearing up all the concepts in half an hour or less, keep up the great work!
Thanks 🙂🙂
I have read alot about microservices. But this playlist Sums everything up. Thanks alot.
Good to hear that Man 👍👍😊
Nice explanation and illustration, without wasting time. Great job!
Thanks a lot Raj 👍👍
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.
Thanks. Sure👍👍 we will cover more real time examples👍
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!..
Thanks 😊😊
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.
Means a lot to us Ashish 🙏🙏
Helped me to understand the topic quite easily. Great job! 👍😀
Thanks Sonu 😊❤️
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
Thanks 😊😊 many congratulations on cracking your interviews 👍👍
Thanks a lot for such a brief explanation. I was waiting for it from a long time back...😊👌👍
M glad it helps 👍🙂
Thanks for this video. Expected one.... first like...
Thanks a lot 🙂🙂👍👍
Nice and able to understand with more clarity. Thanks for your video.🙏
Thanks Sajeesh 🙂🙂👍👍
this video is not for learning , but getting the entire concept clear in just 20 mins.
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
Thanks a lot 🙂🙂. Sure we will do that 👍👍
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!
Just 1/2hr ago it was asked in interview. Thanks for sharing this wonderful video🤩✌
Thanks Manoj. M sure things will settle up soon 👍👍
@@CodeDecode Ya one day definitely with the support of #CodeDecode
👍👍keep rocking Manoj 👍👍
Good content on the MS Design Patterns.
Thanks
Can you please also describe Chreography and orchestration with coding examples, TIA
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?
Sure Atul 👍
Hey thank you for making such great videos.. please make videos for other three types of design patterns
Sure 👍
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?
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.
very very nice and clear explanation madam. thank you for your videos
you are welcome shankar
great video thanks code decode
😊👍
hi , this video is truely very good , please try making videos of CQRS and other design patterns of Microservices. Thanks
Sure we will try to upload that video soon 👍
Thank you very much..pls add videos for other patterns also
Sure Richard 👍👍🙂🙂
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
kzhead.info/channel/PLyHJZXNdCXselvpjEhygQ9GlDQihtQj6i.html
Thanks a lot Vidhya👍👍🙂🙂
Very good explanation. thannks
Thanks 😊
Thank you very much .. 😊
🙂🙂👍👍
Well explained
Thanks Rucha 🙂
Very nicely explained. Hats off!! Pls create a video for CQRS design pattern as well.
Thanks 👍
Hi,This is really helpful. Can you please also describe Chreography and orchestration with coding examples?
Sure Komal 👍
Thanks maam. Good one
Thanks Akash 🙂🙂
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
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?
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
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
Same request from my side as well
please make a video for CQRS and Event sourcing Design patterns
Orchestration Pattern is the Synchronous Communication right?
Thankyou dear
🙂🙂
please add video from spring batch process excel file microservice
Sure 👍👍
Can you explain what is the difference between this transaction communication and microservices communication.
what is interceptor and how to create own interceptor in microservices ? and one more thing how to implement saga approach
Good explanation, can you please add CQRS design patterns video with example?
Sure om 👍👍🙂🙂
Super akka
Thanks
Please add example for the above concept , as per theory able to understand but if u added the coding part ,it will be wonderful.
Sure sure 👍👌
Please do a series of design patterns and their use in micro services…
Sure 😊👍👍
Can you please create videos for other design patterns too? Thanks in advance.
Sure 👍👍 we will do that 👍
👍💯
Thanks Rishi 👍👍
Can you pls implement Spring boot application of it
If orchestration itself has its own problems then what is the solution?
Good one though but this video title is misleading saying interview question, it's SAGA tutorial only.
i have no clue on what swiggy or zomato sounds like uber or grub hub ?
Can we have any implementation for Saga... which is good to work with Distributed tx
Sure👍
Please can u add videos for CQRS pattern
Sure 👍
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💯
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???
@@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
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 🙂🙂
@@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.✨️
@@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
very nice video. is it possible for you to take CQRS, EVENT SOURCING
Sure Anand 👍👍
I have a set of questions on Microservices, could you please help me with them?
Sure Prateek. Shoot👍
@@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?
Thanks for the content. Please create other design pattern videos like CQRS
sure we will create it soon
Please show example for saga pattern .
Sure Shilpa 👍🙂
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 ??
Your money got deducted and you have no food 😁😁😁😁 3:36
🤪
There is much English rather than facts and knowledge
One question, using the orchestrator, is the orchestrator microservice required to have its own database too?
Nicely explained 🫡 Can you make a demo for this one?
Sure Manish 👍