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

  Рет қаралды 70,054

Code Decode

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: kzbin.info?...
LinkedIn : / codedecodeyoutube
Instagram: / codedecode25
#sagadesingpattern #interviewquestions #codedecode

Пікірлер: 126
@balag2368
@balag2368 Жыл бұрын
Got many offers just in ten days. Your playlist is enough to clear any interviews.
@CodeDecode
@CodeDecode Жыл бұрын
Many congratulations Bala 👏👏👏👏. Well done . Keep learning keep shining Man 👍👍👍
@hackstreet781
@hackstreet781 10 ай бұрын
absolutely. I also got 2 offers.
@kartiksachdeva4196
@kartiksachdeva4196 4 ай бұрын
Which companies
@ysatyadivy
@ysatyadivy 3 ай бұрын
Do you have experience before in JAVA or did you try as a fresher?
@kartiksachdeva4196
@kartiksachdeva4196 3 ай бұрын
​@@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!
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂🙂
@abdulmaliknurudeen7331
@abdulmaliknurudeen7331 9 ай бұрын
I have read alot about microservices. But this playlist Sums everything up. Thanks alot.
@CodeDecode
@CodeDecode 9 ай бұрын
Good to hear that Man 👍👍😊
@sreejeshraj4800
@sreejeshraj4800 Жыл бұрын
Nice explanation and illustration, without wasting time. Great job!
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a lot Raj 👍👍
@user-gw2fc6bf4f
@user-gw2fc6bf4f 2 ай бұрын
this video is not for learning , but getting the entire concept clear in just 20 mins.
@razvan-danielmihaescu1555
@razvan-danielmihaescu1555 Жыл бұрын
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 Жыл бұрын
Thanks. Sure👍👍 we will cover more real time examples👍
@thiyamybabygirl2144
@thiyamybabygirl2144 Жыл бұрын
Thanks for this video. Expected one.... first like...
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a lot 🙂🙂👍👍
@manojkumarpadhi2445
@manojkumarpadhi2445 Жыл бұрын
Thanks a lot for such a brief explanation. I was waiting for it from a long time back...😊👌👍
@CodeDecode
@CodeDecode Жыл бұрын
M glad it helps 👍🙂
@user-fc7th5rw1z
@user-fc7th5rw1z 3 ай бұрын
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 3 ай бұрын
Thanks 😊😊 many congratulations on cracking your interviews 👍👍
@mohammedsufi4649
@mohammedsufi4649 4 ай бұрын
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!..
@CodeDecode
@CodeDecode 4 ай бұрын
Thanks 😊😊
@AshishSingh-rx4sq
@AshishSingh-rx4sq Жыл бұрын
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 🙏🙏
@sonujain4768
@sonujain4768 6 ай бұрын
Helped me to understand the topic quite easily. Great job! 👍😀
@CodeDecode
@CodeDecode 6 ай бұрын
Thanks Sonu 😊❤️
@sajeeshkumar4510
@sajeeshkumar4510 Жыл бұрын
Nice and able to understand with more clarity. Thanks for your video.🙏
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sajeesh 🙂🙂👍👍
@manoj47parmar
@manoj47parmar Жыл бұрын
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 Жыл бұрын
@@CodeDecode Ya one day definitely with the support of #CodeDecode
@CodeDecode
@CodeDecode Жыл бұрын
👍👍keep rocking Manoj 👍👍
@truthreveal6521
@truthreveal6521 Жыл бұрын
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 👍👍
@hackstreet781
@hackstreet781 10 ай бұрын
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 9 ай бұрын
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.
@jayjoshi1366
@jayjoshi1366 5 ай бұрын
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!
@Atul_Shegokar
@Atul_Shegokar Жыл бұрын
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?
@CodeDecode
@CodeDecode Жыл бұрын
Sure Atul 👍
@arpanagrawal4264
@arpanagrawal4264 Жыл бұрын
Very nicely explained. Hats off!! Pls create a video for CQRS design pattern as well.
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 👍
@shankark1664
@shankark1664 5 ай бұрын
very very nice and clear explanation madam. thank you for your videos
@CodeDecode
@CodeDecode 4 ай бұрын
you are welcome shankar
@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
@vidhyavd8385
@vidhyavd8385 Жыл бұрын
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 Жыл бұрын
kzbin.info/aero/PLyHJZXNdCXselvpjEhygQ9GlDQihtQj6i
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a lot Vidhya👍👍🙂🙂
@santhoshr2497
@santhoshr2497 2 ай бұрын
Hey thank you for making such great videos.. please make videos for other three types of design patterns
@CodeDecode
@CodeDecode 2 ай бұрын
Sure 👍
@abhishekgowlikar
@abhishekgowlikar 5 ай бұрын
Good content on the MS Design Patterns.
@CodeDecode
@CodeDecode 5 ай бұрын
Thanks
@krishnalakshmi8896
@krishnalakshmi8896 8 ай бұрын
hi , this video is truely very good , please try making videos of CQRS and other design patterns of Microservices. Thanks
@CodeDecode
@CodeDecode 8 ай бұрын
Sure we will try to upload that video soon 👍
@layarichard6739
@layarichard6739 Жыл бұрын
Thank you very much..pls add videos for other patterns also
@CodeDecode
@CodeDecode Жыл бұрын
Sure Richard 👍👍🙂🙂
@AshishAshish-fp8po
@AshishAshish-fp8po 7 күн бұрын
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
@komalsingh-vi2ur
@komalsingh-vi2ur Жыл бұрын
Hi,This is really helpful. Can you please also describe Chreography and orchestration with coding examples?
@CodeDecode
@CodeDecode Жыл бұрын
Sure Komal 👍
@srndrpec
@srndrpec Жыл бұрын
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?
@phanimc11211
@phanimc11211 Жыл бұрын
Can you please also describe Chreography and orchestration with coding examples, TIA
@zmxn007
@zmxn007 8 ай бұрын
Very good explanation. thannks
@CodeDecode
@CodeDecode 7 ай бұрын
Thanks 😊
@rajenderprasad1193
@rajenderprasad1193 Жыл бұрын
Thank you very much .. 😊
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂👍👍
@PolaSantosh27
@PolaSantosh27 Жыл бұрын
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 Жыл бұрын
Same request from my side as well
@dummymail6029
@dummymail6029 2 ай бұрын
great video thanks code decode
@CodeDecode
@CodeDecode Ай бұрын
😊👍
@gokulaher2476
@gokulaher2476 2 ай бұрын
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 Жыл бұрын
Well explained
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Rucha 🙂
@akashsaha9366
@akashsaha9366 Жыл бұрын
Thanks maam. Good one
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Akash 🙂🙂
@tysonnfury9226
@tysonnfury9226 Жыл бұрын
Thankyou dear
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂
@omprakash-vq3wq
@omprakash-vq3wq Жыл бұрын
Good explanation, can you please add CQRS design patterns video with example?
@CodeDecode
@CodeDecode Жыл бұрын
Sure om 👍👍🙂🙂
@anandu06
@anandu06 Жыл бұрын
Please add example for the above concept , as per theory able to understand but if u added the coding part ,it will be wonderful.
@CodeDecode
@CodeDecode Жыл бұрын
Sure sure 👍👌
@karthiknainupatruni5022
@karthiknainupatruni5022 Жыл бұрын
please make a video for CQRS and Event sourcing Design patterns
@na2599
@na2599 2 ай бұрын
Orchestration Pattern is the Synchronous Communication right?
@jayakrishnathammana
@jayakrishnathammana Жыл бұрын
Please do a series of design patterns and their use in micro services…
@CodeDecode
@CodeDecode Жыл бұрын
Sure 😊👍👍
@tysonnfury9226
@tysonnfury9226 Жыл бұрын
Can you explain what is the difference between this transaction communication and microservices communication.
@hamednikbakht9708
@hamednikbakht9708 Жыл бұрын
please add video from spring batch process excel file microservice
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍
@lovebranch-hemavasanth
@lovebranch-hemavasanth Жыл бұрын
what is interceptor and how to create own interceptor in microservices ? and one more thing how to implement saga approach
@rishiraj2548
@rishiraj2548 Жыл бұрын
👍💯
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Rishi 👍👍
@sivashankar-sx9ul
@sivashankar-sx9ul 5 ай бұрын
Super akka
@CodeDecode
@CodeDecode 5 ай бұрын
Thanks
@sreejeshraj4800
@sreejeshraj4800 Жыл бұрын
Can you please create videos for other design patterns too? Thanks in advance.
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍 we will do that 👍
@mallesrao
@mallesrao Жыл бұрын
Can we have any implementation for Saga... which is good to work with Distributed tx
@CodeDecode
@CodeDecode Жыл бұрын
Sure👍
@devendra.sanghavi
@devendra.sanghavi 11 күн бұрын
♥♥
@bhavanadurga
@bhavanadurga Жыл бұрын
Can you pls implement Spring boot application of it
@anandnerurkar4471
@anandnerurkar4471 Жыл бұрын
very nice video. is it possible for you to take CQRS, EVENT SOURCING
@CodeDecode
@CodeDecode Жыл бұрын
Sure Anand 👍👍
@jasonsgreen
@jasonsgreen 7 ай бұрын
i have no clue on what swiggy or zomato sounds like uber or grub hub ?
@ArjunKumar-zu2kl
@ArjunKumar-zu2kl Жыл бұрын
Good one though but this video title is misleading saying interview question, it's SAGA tutorial only.
@user-ll6gt2nd9q
@user-ll6gt2nd9q 3 ай бұрын
If orchestration itself has its own problems then what is the solution?
@vandanac2244
@vandanac2244 9 ай бұрын
Please can u add videos for CQRS pattern
@CodeDecode
@CodeDecode 9 ай бұрын
Sure 👍
@arpitsik4649
@arpitsik4649 Жыл бұрын
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 Жыл бұрын
@@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
@ankeshkapil3129
@ankeshkapil3129 2 күн бұрын
how come create and validate and send order happen in one transaction 😅
@sona7806
@sona7806 Жыл бұрын
Thanks for the content. Please create other design pattern videos like CQRS
@CodeDecode
@CodeDecode Жыл бұрын
sure we will create it soon
@PrateekJain348
@PrateekJain348 Жыл бұрын
I have a set of questions on Microservices, could you please help me with them?
@CodeDecode
@CodeDecode Жыл бұрын
Sure Prateek. Shoot👍
@PrateekJain348
@PrateekJain348 11 ай бұрын
@@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?
@shilpasah3388
@shilpasah3388 Жыл бұрын
Please show example for saga pattern .
@CodeDecode
@CodeDecode Жыл бұрын
Sure Shilpa 👍🙂
@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 ??
@indlasubramanyam8766
@indlasubramanyam8766 Жыл бұрын
Your money got deducted and you have no food 😁😁😁😁 3:36
@CodeDecode
@CodeDecode Жыл бұрын
🤪
@rakeshmishraLmp
@rakeshmishraLmp 7 ай бұрын
There is much English rather than facts and knowledge
@Satenc0
@Satenc0 10 ай бұрын
One question, using the orchestrator, is the orchestrator microservice required to have its own database too?
@iammanishvb7332
@iammanishvb7332 Жыл бұрын
Nicely explained 🫡 Can you make a demo for this one?
@CodeDecode
@CodeDecode Жыл бұрын
Sure Manish 👍
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 794 М.
Hot Ball ASMR #asmr #asmrsounds #satisfying #relaxing #satisfyingvideo
00:19
Oddly Satisfying
Рет қаралды 12 МЛН
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 1,1 МЛН
Designing Workflows in Microservices - Orchestration vs Choreography
17:26
Implement SAGA Design Pattern using Spring Boot
2:20:48
Daily Code Buffer
Рет қаралды 77 М.
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 794 М.