BlueXP is now NetApp Console
Monitor and run hybrid cloud data services
ee058acf-aa79-4a2c-a73a-986fadbdb984-0 Welcome and thank you everyone for joining our webinar today on ee058acf-aa79-4a2c-a73a-986fadbdb984-1 building quantifiable efficiency with Cadence. 466ca3c0-f6cd-4e36-9a72-afbc2237e5a6-0 We're going to get started in about one or two minutes just to 466ca3c0-f6cd-4e36-9a72-afbc2237e5a6-1 allow for everyone to get situated. 488acaaa-aa3c-4be1-97e1-a47d78b500e4-0 So hang tight and we will kick off shortly. a9043df4-d93e-4d08-b9fc-c9866b256078-0 All right, welcome and thank you everyone again for joining us a9043df4-d93e-4d08-b9fc-c9866b256078-1 for our webinar today around Cadence. 50fa01fe-44b3-47ed-928f-3dd918c365b9-0 We have an amazing session plan for you today. 2bfc5eb8-7581-4114-84a2-bd7cc6b9b325-0 But before we get started, we have just a few housekeeping 2bfc5eb8-7581-4114-84a2-bd7cc6b9b325-1 items. 10c32b94-4f5e-4bfd-8880-b85683154846-0 So this presentation is going to last around 45 minutes. eedd6923-8964-4925-97b7-2cecc96a0eba-0 Questions are always welcome and we encourage you to type any eedd6923-8964-4925-97b7-2cecc96a0eba-1 questions you have throughout the webinar into the Q&A eedd6923-8964-4925-97b7-2cecc96a0eba-2 window on the right hand side of your screen. cfd0a09e-bc3b-450e-bc92-da5311ce6aee-0 Also as a reminder, this webinar will be available on demand cfd0a09e-bc3b-450e-bc92-da5311ce6aee-1 shortly after the session concludes. b44ce916-a883-4d6b-9337-036daf83aacd-0 All right, so let's get into the fun stuff and the reason all of b44ce916-a883-4d6b-9337-036daf83aacd-1 you guys joined us today. d99d32d7-3c1e-4904-baac-99612f342013-0 Today's webinar will explore the impact on efficiency when using d99d32d7-3c1e-4904-baac-99612f342013-1 Cadence to develop distributed applications. 60145fd1-4c35-4ad8-baf5-e9d520903109-0 Our speaker today is John del Castillo, Technology Evangelist 60145fd1-4c35-4ad8-baf5-e9d520903109-1 here at Insta Cluster. 59c311dc-54a7-4ae5-b153-f729569996b3-0 And with that, I'm going to pass it over to you, John. 134ae06b-6b31-43d5-a40b-c620aba488ed-0 Thanks, Anthony. 64b99708-42dc-4c15-8e2c-5fc80269605a-0 It's great to be here. e6df14d9-f8cb-4297-baf8-e4659ec5f53b-0 Hi everyone. b6136e87-9ca9-445e-b061-a0c3f91c752e-0 It's a beautiful spring morning here in Canberra where I'm at b6136e87-9ca9-445e-b061-a0c3f91c752e-1 9:00 AM. 536540b9-ed75-4f97-ad17-3a4c135f8c4d-0 Beautiful day on the cards for us. dab9aa18-630d-489c-b6bd-85c690038bcf-0 I hope you guys are having a great day wherever you are dab9aa18-630d-489c-b6bd-85c690038bcf-1 today. 2d8e3c75-654e-4470-b53f-0b4800472da7-0 Like we said, we'll have a good session for you today. 897c25dc-8dfa-46fa-98c7-8e6808c14176-0 It will conform to a bunch of different bits. 57933439-a60d-4589-9e53-88df8043d306-0 Let me just move on to the next slide here. 45e15dca-c839-46d4-9a06-b1f1549f2f6c-0 So first, we're going to introduce what cadence is. 408cb847-3ab3-49fa-a3ce-fa812707e8fc-0 You guys are here to hear about cadence. 4b931b87-0df5-4b30-bd33-c97e9d1e026c-0 I'll just do a crash course in what Cadence actually is, and 4b931b87-0df5-4b30-bd33-c97e9d1e026c-1 then we'll introduce the demonstration problem, the 4b931b87-0df5-4b30-bd33-c97e9d1e026c-2 distributed platform or application that we're going to 4b931b87-0df5-4b30-bd33-c97e9d1e026c-3 explore in this. 692844f5-25e9-43ee-adb0-d6dabe79b70c-0 In this webinar, we're going to go through a couple of common 692844f5-25e9-43ee-adb0-d6dabe79b70c-1 risks and mitigations that you need to take in terms of when 692844f5-25e9-43ee-adb0-d6dabe79b70c-2 you're developing a distributed system and some of the things 692844f5-25e9-43ee-adb0-d6dabe79b70c-3 you need to understand around those problems. 2f962744-944f-4160-b3d3-f24dd4ffaa35-0 And then we're going to do abit of a dive into a solution 2f962744-944f-4160-b3d3-f24dd4ffaa35-1 that you could build in native Java without using any external 2f962744-944f-4160-b3d3-f24dd4ffaa35-2 packages or any major solutions in Java. 6e988e7c-c901-4285-99a9-5a83db0ba8b8-0 And we're going to look at some code samples. c0c7608d-9df4-4635-8035-45fc3c94c948-0 I will be clicking around in some browser windows in our in c0c7608d-9df4-4635-8035-45fc3c94c948-1 our VS Code IDE, but it isn't going to get too technical. a61dfd95-fe90-4f34-90d1-a558e53a2b7c-0 Developers should appreciate it, but if you're not technically a61dfd95-fe90-4f34-90d1-a558e53a2b7c-1 minded at that level, you should still be able to follow along a61dfd95-fe90-4f34-90d1-a558e53a2b7c-2 relatively easily. 2cc46321-222f-40e7-940d-f5717af26d46-0 And then after we dive into the native Java solution, we're 2cc46321-222f-40e7-940d-f5717af26d46-1 going to immediately go back-to-back with the Cadence 2cc46321-222f-40e7-940d-f5717af26d46-2 solution. 28939cfb-04c0-47d6-9d60-9f4715b0c5aa-0 And I'll be pointing out things that are obviously different and 28939cfb-04c0-47d6-9d60-9f4715b0c5aa-1 some Cadence specific paradigms which help us sort of manage the 28939cfb-04c0-47d6-9d60-9f4715b0c5aa-2 the solution in,the Cadence parlance. 1a7686f4-fa47-452c-afb6-1e99ead7f903-0 And then what I'm going to do is I'm going to do a bit of a 1a7686f4-fa47-452c-afb6-1e99ead7f903-1 deeper dive into how Cadence actually functions and sort of 1a7686f4-fa47-452c-afb6-1e99ead7f903-2 how the solution that we've built is going to take advantage 1a7686f4-fa47-452c-afb6-1e99ead7f903-3 of these features and how it sort of recovers stuff like 1a7686f4-fa47-452c-afb6-1e99ead7f903-4 that. a1f02585-45e8-4047-83f3-b4e14485c526-0 We are going to do avery brief comparison of the two a1f02585-45e8-4047-83f3-b4e14485c526-1 solutions. 2945558c-2e0a-4ef0-969e-a8b50e258375-0 And we're going to take a high level look at one of the some of 2945558c-2e0a-4ef0-969e-a8b50e258375-1 the things that we're able to mitigate when using Cadence, 2945558c-2e0a-4ef0-969e-a8b50e258375-2 some of the things that we gain as sort of a broader look on 2945558c-2e0a-4ef0-969e-a8b50e258375-3 sort of whether the we can quantify sort of how much 2945558c-2e0a-4ef0-969e-a8b50e258375-4 efficiency we can gain when using a solution like Cadence. 6902d79f-191f-4bd2-b97f-b1a8d8cfc365-0 And then I'll take any questions at the end. 6a593ef6-8f48-4037-9c8f-fbf044c373b9-0 I'm happy to take any questions at any time if you have any. ee7f3ed6-c199-4ce8-a7f5-137b7cb47db6-0 So we'll move on. 7b3d5040-fe9e-46d9-a421-cdda4977b607-0 First of all, let's just introduce Cadence. 1b8e1ae5-cab0-44ed-ad8b-6bdfdb25d334-0 This is again a crash course in what Cadence is. 3b620422-1db7-436c-bdc1-d921b2e559dd-0 So Cadence is a distributed code platform. 3b235c2b-ec6c-4844-afef-b82229cf5ca2-0 You can see here, this is an excerpt from their website and 3b235c2b-ec6c-4844-afef-b82229cf5ca2-1 it's sort of, it can be anything. bede9331-ffbb-4fba-bfb2-a3451f2adbf2-0 I think the,most simple way to think about it,is a bede9331-ffbb-4fba-bfb2-a3451f2adbf2-1 little bit reductive is that it's a workflow management bede9331-ffbb-4fba-bfb2-a3451f2adbf2-2 system or a workflow orchestration system. 66b30f53-9e68-40f5-a6e0-ea689b9153b4-0 And what it actually allows you to do is orchestrate and manage 66b30f53-9e68-40f5-a6e0-ea689b9153b4-1 parcels of work in a stateful way and that are fault tolerant 66b30f53-9e68-40f5-a6e0-ea689b9153b4-2 and are distributed and scalable. 2ec021a4-8794-4618-b914-ce652e81fd11-0 And we'll get into all of the ways that that's possible with 2ec021a4-8794-4618-b914-ce652e81fd11-1 with this solution in a minute. 46d0734d-13bc-4692-b324-5a7431c7acb5-0 It is an open source solution. 42fac5f2-824d-42f4-8f1d-09b09208defc-0 It is. 89ca03e3-d484-4dd5-8f54-64b8f4ee91fa-0 It was originally developed at Uber and they still own the 89ca03e3-d484-4dd5-8f54-64b8f4ee91fa-1 program in the GitHub so that they're the pro project managers 89ca03e3-d484-4dd5-8f54-64b8f4ee91fa-2 at the moment. 590efd35-b351-4999-83f0-412e14298f9a-0 But they are also taking open source contributions and 590efd35-b351-4999-83f0-412e14298f9a-1 Instacluster is proud to be partnering with them to make 590efd35-b351-4999-83f0-412e14298f9a-2 open source contributions to the Cadence project. e65acaf0-8e0f-41a2-aa7a-355154fe9aa6-0 And we have done that in the past and we continue to do so. b2427506-6ee8-40ff-b32f-d746291d3a0d-0 But we also have developed our own Cadence managed service b2427506-6ee8-40ff-b32f-d746291d3a0d-1 offering, which allows customers to come in and create a Cadence b2427506-6ee8-40ff-b32f-d746291d3a0d-2 cluster with just a few clicks of the button on our management b2427506-6ee8-40ff-b32f-d746291d3a0d-3 console. a926ce2d-b4e4-4ef7-86f6-b2b2b0bf0863-0 And that's the last of the sales pitch I'll give to you today. e215fcde-3729-411c-85c2-c7ed223cb2ce-0 It's not about instant cluster so much today as it is about e215fcde-3729-411c-85c2-c7ed223cb2ce-1 Cadence and what you can do with the platform. fc009874-78a9-4f01-90ec-2fce5e94667a-0 So again, we're going to just continue on our crash course. 6b434804-0a5c-4c89-b9a3-61db1074ec53-0 This diagram won't mean a lot to anyone at this point, but I'll 6b434804-0a5c-4c89-b9a3-61db1074ec53-1 try and fill in the gaps for you. ad4db07a-0e8f-4362-a061-09bf18905af1-0 We're going to introduce is just some of the really basic core ad4db07a-0e8f-4362-a061-09bf18905af1-1 concepts of what Cadence has. 3b16c0d7-4000-49f3-9894-c1532b825d10-0 So Cadence, themain paradigms that it builds around 3b16c0d7-4000-49f3-9894-c1532b825d10-1 is the concept of a workflow. c3e2bbc2-e6e3-428c-b7dc-a391b6030f29-0 And you can basically call anything a workflow. bf82b364-6f2f-4856-b361-1c2cf97f848b-0 If you work in software development, you will generally bf82b364-6f2f-4856-b361-1c2cf97f848b-1 be building systems that are operating in a distributed bf82b364-6f2f-4856-b361-1c2cf97f848b-2 manner across sort of a potentially a,long time frame bf82b364-6f2f-4856-b361-1c2cf97f848b-3 that are interlinked tasks. 65b74a9d-3a66-406a-8314-bc1bae041d49-0 So a task has to happen, some work gets done and that will 65b74a9d-3a66-406a-8314-bc1bae041d49-1 kick off a task for another downstream application 65b74a9d-3a66-406a-8314-bc1bae041d49-2 potentially or a piece of functionality. eaf2edd0-3be8-4c2f-9bcf-15e05fb3b165-0 And these things are chained together until we have a final eaf2edd0-3be8-4c2f-9bcf-15e05fb3b165-1 result. 378eed7f-c859-443d-84fa-da45ed9948ef-0 And Cadence packages these paradigms or thesetasks 378eed7f-c859-443d-84fa-da45ed9948ef-1 into a continuous object called a workflow. 5da78b99-85bb-4dee-9bee-312593d87b65-0 And that is sort of the overarching container for a set 5da78b99-85bb-4dee-9bee-312593d87b65-1 of distributed tasks. 14284d39-9e07-4621-abb7-0e86575fa2a1-0 And each of these tasks can be operated on, have a result and 14284d39-9e07-4621-abb7-0e86575fa2a1-1 then return back to the central management system, which is then 14284d39-9e07-4621-abb7-0e86575fa2a1-2 again, we'll date, we'll dive deeper into this as we go along. e4bc0947-5b6d-4405-aa74-745f78651bb0-0 But just I wanted to get across the core concept of Cadence has e4bc0947-5b6d-4405-aa74-745f78651bb0-1 a workflow inside, has anumber of tasks or in Cadence e4bc0947-5b6d-4405-aa74-745f78651bb0-2 parlance, they're called activities. 7f7f2c14-b2c2-41a9-ab68-a38d1e494054-0 And this loose structure is what content, what sort of forms a 7f7f2c14-b2c2-41a9-ab68-a38d1e494054-1 workflow and is the final result of what Cadence is providing to 7f7f2c14-b2c2-41a9-ab68-a38d1e494054-2 you. cfe24db6-7a1c-4471-a367-05543bfe6239-0 Again, we're going to go into this, so don't worry too much if cfe24db6-7a1c-4471-a367-05543bfe6239-1 it's lacking better detail. f5f055a3-d9fe-413a-a96b-67ade5e3c5d9-0 Just a introduction to what Cadence actually looks like in f5f055a3-d9fe-413a-a96b-67ade5e3c5d9-1 terms of an application. b4fc76b5-1e52-45da-b4dc-24e6416738a8-0 So you can run it as a single node instead. 13398e78-9b1f-4429-9653-e86cacd04009-0 Cluster provides it as a clustered environment, obviously 13398e78-9b1f-4429-9653-e86cacd04009-1 for fault tolerance and for redundancy purposes. 876a5a30-04b0-4496-b928-1a4dcd86c2ed-0 So we offer it in a three node configuration. a3cb63b4-d6c4-401f-80b0-e85071c3cb25-0 You can actually scale it to as many nodes as you require a3cb63b4-d6c4-401f-80b0-e85071c3cb25-1 depending on your compute needs. b7b75ebd-020c-4aed-a013-e1fc30936680-0 And these front end service nodes, these are the nodes that b7b75ebd-020c-4aed-a013-e1fc30936680-1 you're actually interacting with as an engineer. 510515b4-7223-442d-9091-b738c3cc2340-0 You're building a connection string to the stateless machine. ab234e40-e156-41ba-b79c-2167d4be613f-0 They're stateless servers and they can serve multiple roles ab234e40-e156-41ba-b79c-2167d4be613f-1 and they do need to be load balanced. 4025fa98-a0d8-4635-abc1-e17b69b2bb76-0 So that's a, that's a product that Insta Cluster offers sort 4025fa98-a0d8-4635-abc1-e17b69b2bb76-1 of out-of-the-box. 1db2fe0b-a1dd-428c-a28d-9d09ff35e269-0 If you create a Cadence application in on the Insta 1db2fe0b-a1dd-428c-a28d-9d09ff35e269-1 Cluster platform, you'll get 3 nodes which have a load balancer 1db2fe0b-a1dd-428c-a28d-9d09ff35e269-2 in front of them and you can use the connection string that we 1db2fe0b-a1dd-428c-a28d-9d09ff35e269-3 provide. 2fda1ef4-936d-4c81-9637-31f6c30d887d-0 And as it mentions there, the client actually connects to 2fda1ef4-936d-4c81-9637-31f6c30d887d-1 these endpoints. 56aaf649-03fa-47a6-a8ba-f6f373645844-0 And that's what you see at the top of this diagram here. 671a97a8-c78b-4ea3-ad4d-14724b8f0103-0 The cluster front end services, the other side of Cadence is a 671a97a8-c78b-4ea3-ad4d-14724b8f0103-1 persistence back end. e7fca0e8-1fe8-4a17-87a3-f3764a617ceb-0 Now Instacluster users, Cassandra, we are Cassandra e7fca0e8-1fe8-4a17-87a3-f3764a617ceb-1 experts. eaa85e24-9af3-41ca-8169-9a2d3d6654e2-0 There is another supported technology, Postgres. a1cb6e74-289b-4c6b-ad23-b3ea50151fae-0 But as a Cadence user and especially if you use a managed a1cb6e74-289b-4c6b-ad23-b3ea50151fae-1 service like Instacluster, you actually don't need to know a1cb6e74-289b-4c6b-ad23-b3ea50151fae-2 anything about the back end services of the Cadence cluster. 1ae29bec-a970-4013-95af-8ae1bee1748e-0 It's actually invisible to the user. 17828f7d-1d2a-4301-804f-aaf5b719378d-0 All when you're building Cadence applications, you're just 17828f7d-1d2a-4301-804f-aaf5b719378d-1 dealing with the front end servers and that's sort of how 17828f7d-1d2a-4301-804f-aaf5b719378d-2 we want it to be. 56b193c5-8d8d-4b55-bb15-54870274772a-0 But just for information sake, there is a positions back end 56b193c5-8d8d-4b55-bb15-54870274772a-1 and it's a proper understood database paradigm. f2a61c98-08e9-41de-a96d-d18fc292540b-0 And then we can see here in the Third Point here we optionally f2a61c98-08e9-41de-a96d-d18fc292540b-1 have things like Kafka and open search for a feature called f2a61c98-08e9-41de-a96d-d18fc292540b-2 advanced visibility. 10ee0d03-85e4-47a1-92e1-8b75e945b775-0 Again, we won't dive into that today, but it is useful to 10ee0d03-85e4-47a1-92e1-8b75e945b775-1 understand what these things are and if you're interested in it 10ee0d03-85e4-47a1-92e1-8b75e945b775-2 to read up about. a00efe94-eb53-45b6-a118-3add5e693c45-0 And here's just, I'm going to revisit this diagram as well, a00efe94-eb53-45b6-a118-3add5e693c45-1 but here's how just a basic, a really high level understanding a00efe94-eb53-45b6-a118-3add5e693c45-2 of how basic workflow can get started in Cadence. 7f19db07-b083-4c8b-b8ba-647341e36051-0 You can see that there is a Cadence client at the top here 7f19db07-b083-4c8b-b8ba-647341e36051-1 that sort of sits separate to that sits on your side or at the 7f19db07-b083-4c8b-b8ba-647341e36051-2 customer side. 49ba02c2-f56d-44c1-80e0-620ffaf82d3e-0 And you can have a number of different clients, obviously 49ba02c2-f56d-44c1-80e0-620ffaf82d3e-1 depending on where you want to situate your client. b5b790df-bd89-41d2-8003-8ec6b4f85c59-0 And all it needs to do is actually send a signal to the b5b790df-bd89-41d2-8003-8ec6b4f85c59-1 Cadence front end service saying I'd like to start a workflow and b5b790df-bd89-41d2-8003-8ec6b4f85c59-2 here are the parameters. d861280c-b853-4b97-927c-52f30f1ef87d-0 And that's basically the Cadence client job done. 56dc51ab-eca2-47e1-b8a6-ff632c8b1300-0 And sorry, again, we'll revisit this diagram in a bit more 56dc51ab-eca2-47e1-b8a6-ff632c8b1300-1 detail to understand the flow of all these other parts of the 56dc51ab-eca2-47e1-b8a6-ff632c8b1300-2 Cadence application and architecture, but for now, 56dc51ab-eca2-47e1-b8a6-ff632c8b1300-3 that'll probably do. 5de5ad3c-88cc-4e0e-9e1d-130ca2676e0c-0 So hopefully you have a decent sort of entry level 5de5ad3c-88cc-4e0e-9e1d-130ca2676e0c-1 understanding of what Cadence is and how it works, or at least 5de5ad3c-88cc-4e0e-9e1d-130ca2676e0c-2 you think you might have an understanding. adb53758-6c81-412c-bf0e-19f46864007b-0 Now we're going to introduce the distributed application that adb53758-6c81-412c-bf0e-19f46864007b-1 we'd like to have a solution for. 97189cbc-6abd-46be-a36c-297fefddcbe1-0 Now, this one we're calling Instafood. 6ce92e8f-1d85-4a05-b015-06cdfd756a1a-0 And this is actually a use case that we developed as part of our 6ce92e8f-1d85-4a05-b015-06cdfd756a1a-1 Cadence cookbooks, which you can find on GitHub. eaa27830-2d87-4475-8858-9c324172c06e-0 And the cookbooks go into a number of different scenarios eaa27830-2d87-4475-8858-9c324172c06e-1 that Cadence can cater its solutions to. 82deef64-645a-49e2-bf50-4f6657818ce2-0 So one of them is based on polling, one of them is based on 82deef64-645a-49e2-bf50-4f6657818ce2-1 child workflows, and another one based on versioning. d5c3595c-6184-47df-b130-135c5a0077dc-0 So I've taken this example out of the cookbooks that we have d5c3595c-6184-47df-b130-135c5a0077dc-1 and I'm going to be using that as our solution that we want to d5c3595c-6184-47df-b130-135c5a0077dc-2 build for. 9cdeebd9-b55b-4478-9267-b6c6cb4c1240-0 And here, here's a top level understanding ofwhat it is. 904e7af0-7f40-4a51-a484-7dacb0acbea2-0 So it's a food delivery service essentially at the left here, a 904e7af0-7f40-4a51-a484-7dacb0acbea2-1 customer orders some food and it's obviously a single menu 904e7af0-7f40-4a51-a484-7dacb0acbea2-2 that could be coming out of a number of different restaurants. 1b1eb16e-2a18-40f7-84fd-abdbf00df607-0 The order is created and then a request is sent to the specific 1b1eb16e-2a18-40f7-84fd-abdbf00df607-1 restaurant that you've selected. 61f27ae6-fda1-4416-bb65-b17437517689-0 In this case, it's a restaurant called Mega Burger. cc537f54-5c80-40f8-9f7b-758332f9b0df-0 And this restaurant is responsible for obviously cc537f54-5c80-40f8-9f7b-758332f9b0df-1 cooking the food and preparing the meal. 038a9bd1-d4fb-4f8d-8b42-dbde1e6060ce-0 And at the same time, we would like to dispatch a delivery 038a9bd1-d4fb-4f8d-8b42-dbde1e6060ce-1 driver to collect the meal and then deliver it to the customer. 693f1517-a64a-42a2-a7b7-c4dbb8a3cc93-0 It's a pretty simple concept and it is sort of the basis on which 693f1517-a64a-42a2-a7b7-c4dbb8a3cc93-1 that we're going to be building this sort of demo. dc0a39d9-7c06-4f0f-a1e7-d1fca66e1556-0 And it's also the reason we chose this demo is because it's dc0a39d9-7c06-4f0f-a1e7-d1fca66e1556-1 actually one of the key solutions, the reasons that Uber dc0a39d9-7c06-4f0f-a1e7-d1fca66e1556-2 has developed or is utilising Cadence in their own systems, it dc0a39d9-7c06-4f0f-a1e7-d1fca66e1556-3 is for food delivery and their driver management system as dc0a39d9-7c06-4f0f-a1e7-d1fca66e1556-4 well. b17bcf0f-1198-423d-9ddc-c5d167143994-0 So again, we're going to revisit all of these diagrams, but these b17bcf0f-1198-423d-9ddc-c5d167143994-1 are the sort of the core pieces. 927fbe0f-67f3-4886-ae8e-5b09d5e889a2-0 So if we dive into a bit more detail of the requisite 927fbe0f-67f3-4886-ae8e-5b09d5e889a2-1 services, you can see here in the restaurant service and the 927fbe0f-67f3-4886-ae8e-5b09d5e889a2-2 delivery service, we also have a third party API that we don't 927fbe0f-67f3-4886-ae8e-5b09d5e889a2-3 own. 6820923f-1363-4bbd-9ec1-27f77a6f951f-0 This is for obvious reasons. 66e06536-5ede-4303-b8d6-4b0e835700b6-0 So if you're building a distributed system, if you're 66e06536-5ede-4303-b8d6-4b0e835700b6-1 building A food delivery system, you're not going to own the 66e06536-5ede-4303-b8d6-4b0e835700b6-2 specific APIs for each of the restaurants you're dealing with. 5dfea047-1c82-4e2b-8a8d-88bc52413c4f-0 And similarly for the Courier service, that's you're not going 5dfea047-1c82-4e2b-8a8d-88bc52413c4f-1 to own your own Courier service, right? 08fd2811-49ef-4a2d-953d-8c54d88acf94-0 You want to actually distribute this load out to other third 08fd2811-49ef-4a2d-953d-8c54d88acf94-1 parties and you're going to be interacting with their APIs. 6d6bcaac-aec3-4b72-9909-d54874a36ee3-0 And those APIs are almost always going to be exclusively read 6d6bcaac-aec3-4b72-9909-d54874a36ee3-1 only APIs. 5422f284-524f-4af3-a3f3-6606627dbc4c-0 There's very rarely going to be a way for you to integrate every 5422f284-524f-4af3-a3f3-6606627dbc4c-1 single restaurant with messages going back and forth. 117eb07c-0f64-4aaf-b169-ea6826bf865d-0 You're going to be sending requests to these APIs and then 117eb07c-0f64-4aaf-b169-ea6826bf865d-1 polling the status as it gets updated. 0a316ad6-96d3-4182-b30e-350d4d6a4447-0 And this is a core concept of, you know, dealing with any third 0a316ad6-96d3-4182-b30e-350d4d6a4447-1 party API. bb14cd58-5e31-4d90-b2cf-543fbbf99492-0 But I just wanted to call out in detail here how each of the bb14cd58-5e31-4d90-b2cf-543fbbf99492-1 services will do that. 40b2505e-a883-4b9c-a342-d0237e4f62de-0 So for the restaurant service, we're going to be creating an 40b2505e-a883-4b9c-a342-d0237e4f62de-1 order and then polling the details as it's been accepted as 40b2505e-a883-4b9c-a342-d0237e4f62de-2 it sort of starts a different stage of cooking. dca1f80c-5126-494b-a167-9efb4b3738c5-0 And then finally when it's ready. 790844e7-ca67-4a58-aed3-b4ff22579a15-0 And the reason we're polling these statuses is so that we can 790844e7-ca67-4a58-aed3-b4ff22579a15-1 update the customer on the progress of it's of their order. b0e35307-bd41-4925-9861-c7642e3ce6b3-0 And similarly, the exact same thing for the delivery service. 549bcf05-7564-4865-98d7-64034ea3b3cf-0 We're going to schedule a Courier and then ensure that the 549bcf05-7564-4865-98d7-64034ea3b3cf-1 delivery has been accepted and that the courier's on route and 549bcf05-7564-4865-98d7-64034ea3b3cf-2 then finally has been delivered. e14afba8-f712-4e1b-b2f2-c31a61012b83-0 Again, we're going to dive into these a bit more detail, but e14afba8-f712-4e1b-b2f2-c31a61012b83-1 that's just sort of the high level understanding of what the e14afba8-f712-4e1b-b2f2-c31a61012b83-2 scenario is we're dealing with. 7d03f52c-2b13-49d5-930a-c8bdf4c9653e-0 But what are some of the risks that we may have with a system 7d03f52c-2b13-49d5-930a-c8bdf4c9653e-1 like this or quite commonly with all distributed systems? e7e715fe-7701-4b9e-a394-8f7bcc03e6d7-0 So the first risk is handling high concurrency. cf3b1308-c093-41ec-92e7-2ff5df50664a-0 Obviously when we're building a application like this, we really cf3b1308-c093-41ec-92e7-2ff5df50664a-1 want it to be super popular. 43395cfc-648c-4fff-88b1-06b0424fa998-0 The more customers we're getting in, obviously the more 43395cfc-648c-4fff-88b1-06b0424fa998-1 successful the company will be. d69f50fb-deda-4b31-8c00-1f8d20ddc54c-0 But that also comes with risks. ce2300d2-ba97-420b-9b13-beb767023c5f-0 If you consider the Insta food application, if you have, you ce2300d2-ba97-420b-9b13-beb767023c5f-1 know, hundreds or thousands of customers creating orders, you ce2300d2-ba97-420b-9b13-beb767023c5f-2 know, especially around mealtimes like lunch and dinner, ce2300d2-ba97-420b-9b13-beb767023c5f-3 that'll create an extreme amount of stress on your services. 8a87bd47-7f6a-4aca-a3b4-1e7e3954a83b-0 And one of the risks that weneed to understand how to 8a87bd47-7f6a-4aca-a3b4-1e7e3954a83b-1 mitigate is hiking currency. 048d7021-89fc-47c1-9fa9-05d466dba613-0 We don't. 5c83d3f6-3fb2-4439-8124-803d942bbf99-0 We have two competing requirements here. dc694ef8-4b58-4b7a-908f-1f8570aa2f6a-0 The system should have should be able to create these orders dc694ef8-4b58-4b7a-908f-1f8570aa2f6a-1 instantaneously. 530ccc0a-05bb-4dca-8bc0-f170640514e8-0 We want the user experience not tobe slow, and we want it to 530ccc0a-05bb-4dca-8bc0-f170640514e8-1 be instantaneous and be snappy andusable. c84403d8-5825-4695-824f-bc2426c7f318-0 But we also don't want the downstream services to get c84403d8-5825-4695-824f-bc2426c7f318-1 overloaded with essentially too much load that they can't c84403d8-5825-4695-824f-bc2426c7f318-2 handle. eb7538c0-f32f-4620-8b24-b63a0f5be46d-0 So we need a solution in between that can handle that can deal eb7538c0-f32f-4620-8b24-b63a0f5be46d-1 with both scenarios. 36ee5b09-ea2e-4b63-ae14-e42cec94d3a4-0 And one of the solutions, I'm not saying it's the only 36ee5b09-ea2e-4b63-ae14-e42cec94d3a4-1 solution is something like a queue O we need to enable to 36ee5b09-ea2e-4b63-ae14-e42cec94d3a4-2 enable do which. e60b52d8-117c-42f6-9ad0-ef8faac38b2f-0 So a queue will enable the customer from to be able to e60b52d8-117c-42f6-9ad0-ef8faac38b2f-1 create an order without having to worry about the downstream e60b52d8-117c-42f6-9ad0-ef8faac38b2f-2 load. 377b5bf2-39ed-4ba8-aea6-bf013a0e23e3-0 It'll be placed onan interim queue. da9b3a3c-4a47-430b-a318-68426d74361a-0 And that allows the downstream services to operate over the da9b3a3c-4a47-430b-a318-68426d74361a-1 request as quickly as they're able to rather than being da9b3a3c-4a47-430b-a318-68426d74361a-2 overloaded with a number of quests that requests they can da9b3a3c-4a47-430b-a318-68426d74361a-3 handle and potentially would drop. 2c55d5c5-e7b5-4612-8a9d-884e0a722a87-0 And solutions that may be able to solve this problem is stuff 2c55d5c5-e7b5-4612-8a9d-884e0a722a87-1 like Rabbit MQ or Kafka. 2cc92ffd-4eb7-4480-ac23-78a7dffd50eb-0 And you can even use Redis as a message broker system. e019d62b-e99e-4be4-a4a9-5f6e56f14040-0 Another risk for a distributed application is service failure. 98db5eb0-5360-48bd-9df3-9a07750cd41b-0 And now this is arisk that happens with not just 98db5eb0-5360-48bd-9df3-9a07750cd41b-1 distributed systems, but it can be particularly difficult to 98db5eb0-5360-48bd-9df3-9a07750cd41b-2 deal with when you are dealing with a number of different 98db5eb0-5360-48bd-9df3-9a07750cd41b-3 services that need to interact and need to mainstate between 98db5eb0-5360-48bd-9df3-9a07750cd41b-4 maintain,state between them. 8a285af7-2531-481a-8cc1-55445eaf4f52-0 So if you imagine our restaurant service and we have created a 8a285af7-2531-481a-8cc1-55445eaf4f52-1 restaurant order and we sent it to the downstream restaurant and 8a285af7-2531-481a-8cc1-55445eaf4f52-2 then that service crashes. 52b774e2-6047-4d52-875a-14a6cd64e7b7-0 Now that could be because it received a exception it wasn't 52b774e2-6047-4d52-875a-14a6cd64e7b7-1 ready for. 06103707-ce95-41d8-8134-94fe643cb251-0 It could be that we've done operating system upgrades or it 06103707-ce95-41d8-8134-94fe643cb251-1 could be that someone's just restarted the server forno 06103707-ce95-41d8-8134-94fe643cb251-2 particular reason. b67821c9-6d07-46ee-b627-74b0f995aba5-0 We need to be able to understand how we can recover from these b67821c9-6d07-46ee-b627-74b0f995aba5-1 scenarios. cfe01a18-5693-4d58-8078-78fe8b820eaa-0 So there's a couple of things that we need to think about is cfe01a18-5693-4d58-8078-78fe8b820eaa-1 we need to the ability to recover in flight operations. 36eeeefe-ba79-4e1a-8af6-6b5713c4fa97-0 So if a service is under way and we've made it, we've made an 36eeeefe-ba79-4e1a-8af6-6b5713c4fa97-1 order, we want to make sure that we can recover to the same point 36eeeefe-ba79-4e1a-8af6-6b5713c4fa97-2 that we start that we failed in. 849e1a3b-d3b7-4b6e-9228-ca4b3af6f566-0 And as I mentioned, there's a number of different reasons why 849e1a3b-d3b7-4b6e-9228-ca4b3af6f566-1 service failure can happen and we can't mitigate all of them 849e1a3b-d3b7-4b6e-9228-ca4b3af6f566-2 just with a distributed application, we need to actually 849e1a3b-d3b7-4b6e-9228-ca4b3af6f566-3 be able to handle the scenarios where it's being terminated. a541532d-c780-485c-877a-c1de31dbd249-0 And one of the ways that we can do this, again, there's a number a541532d-c780-485c-877a-c1de31dbd249-1 of different ways, is we can persist the state of our a541532d-c780-485c-877a-c1de31dbd249-2 operations when we're making updates. 0d9f1621-d8bb-48b4-8e93-d9eb9282df52-0 So for example, in our previous example, when we make an order 0d9f1621-d8bb-48b4-8e93-d9eb9282df52-1 to our downstream restaurant, we can then persist the state that 0d9f1621-d8bb-48b4-8e93-d9eb9282df52-2 we've made that order and we said the order has been created. 56d58135-f730-41ef-8b3b-1ff7f9a3b171-0 And then if the service crashes and we restart, we can then look 56d58135-f730-41ef-8b3b-1ff7f9a3b171-1 at the state that we've stored in our state machine and we can 56d58135-f730-41ef-8b3b-1ff7f9a3b171-2 see that we've already created the order and we will know not 56d58135-f730-41ef-8b3b-1ff7f9a3b171-3 to replay that particular part of the operation. 6ed4db1d-f465-4d5e-8af5-d004769d1748-0 And that is really important ina lot of distributed systems. e5a3d49c-8400-46a9-bfdb-b0480fe9d1ce-0 But let's take explicitly our restaurant. 52ab0d73-8693-40dd-94ee-d23e1b6ee8ec-0 We don't want to be reordering the same food from the same 52ab0d73-8693-40dd-94ee-d23e1b6ee8ec-1 restaurant. 84dcfad1-b77e-4be4-bc6f-b70df6a554db-0 That would be extremely detrimental to the system and 84dcfad1-b77e-4be4-bc6f-b70df6a554db-1 expensive to our company. c531520f-5e04-4702-8b19-a18795631632-0 So state persistence is necessary and we can handle this c531520f-5e04-4702-8b19-a18795631632-1 in, again a number of different ways, but one of the most common c531520f-5e04-4702-8b19-a18795631632-2 ways is we just persist the state in a database. 8ef45269-4d06-47b7-b969-0daf8187aa9a-0 So we have a model that represents the orders that we 8ef45269-4d06-47b7-b969-0daf8187aa9a-1 want to keep track of and we store them in a database, 8ef45269-4d06-47b7-b969-0daf8187aa9a-2 something like Postgres or Cassandra. c3c8205f-f847-41d6-bef4-a8d19516411d-0 The third, and again, I'm not going to go into all of the c3c8205f-f847-41d6-bef4-a8d19516411d-1 potential risks. 238b3c33-541c-4d1c-acae-82fc715cdd46-0 The third risks that we have is when dealing with a third party 238b3c33-541c-4d1c-acae-82fc715cdd46-1 API, we have essentially no control over how that third 238b3c33-541c-4d1c-acae-82fc715cdd46-2 party API behaves. 7aeee2d2-1e8d-4991-b032-bd245de65932-0 So some of those risks are one,of the main things is that 7aeee2d2-1e8d-4991-b032-bd245de65932-1 sometimes things just take time. bf407fe7-1d9a-498c-ba67-78d0143176cf-0 So for example, if you're ordering a pizza, it will take bf407fe7-1d9a-498c-ba67-78d0143176cf-1 around 15 minutes if everything goes well for it to create, you bf407fe7-1d9a-498c-ba67-78d0143176cf-2 know, and that's sort of bare minimum time frame. 0058ebea-5ed7-4c53-b5c9-bff96b53e542-0 So we have to understand and we don't have, we're not able to 0058ebea-5ed7-4c53-b5c9-bff96b53e542-1 have that third party API send us a signal back, right? b1556fd8-a764-4ab9-a791-062ddd52c78f-0 Like we're not going to be able to just wait for them to tell us b1556fd8-a764-4ab9-a791-062ddd52c78f-1 it's ready. 39d09433-640f-4952-953c-68b6dbb4f5f7-0 We have to constantly be polling, but how long can you 39d09433-640f-4952-953c-68b6dbb4f5f7-1 realistically be polling on a thread? baf4000d-2211-471a-89e0-4d426c105762-0 Can we leave that thread blocked for in the entire time that a baf4000d-2211-471a-89e0-4d426c105762-1 pizza's cooking? 82dc7ec8-3971-4199-8cb4-a5d6ca8a55da-0 We probably could, but should we? 2f580089-5360-470e-97b6-4ef2062def06-0 That's another question we need to answer. dcf75df9-208c-4fcd-a032-c413e2a32387-0 And then the other side of third party APIs is how do we handle dcf75df9-208c-4fcd-a032-c413e2a32387-1 these APIs failing? 3b13866a-fe61-4358-917d-55d8177bb7a5-0 So, you know, every API is different and every company has 3b13866a-fe61-4358-917d-55d8177bb7a5-1 their own capabilities. ebd9151f-1ade-4cf6-a47a-05bbd95a2af0-0 So some may temporarily be unresponsive if they're being ebd9151f-1ade-4cf6-a47a-05bbd95a2af0-1 upgraded, or if they failed, they may return unexpected or ebd9151f-1ade-4cf6-a47a-05bbd95a2af0-2 unreliable responses. ee6261df-0c86-407d-ba04-b17f8ddda6f4-0 Some APIs, you know, they're constantly making changes or ee6261df-0c86-407d-ba04-b17f8ddda6f4-1 they just have unclear failure messages. c0fc8052-a36a-4300-869b-ac4cca26e5c6-0 And then other others may have strict rate limiting, which c0fc8052-a36a-4300-869b-ac4cca26e5c6-1 means that if you're constantly polling, you may get rejections c0fc8052-a36a-4300-869b-ac4cca26e5c6-2 because youcan't polling too quickly and you need to be c0fc8052-a36a-4300-869b-ac4cca26e5c6-3 able to handle that in your code base. 5fe8a2b6-51de-41a1-8463-32bfd20fa021-0 So how do we design services to handle these scenarios? 6b9292f5-4c82-4aee-a508-2cbf69bad137-0 Well, again, we need to build into our solution retry 6b9292f5-4c82-4aee-a508-2cbf69bad137-1 capability. 08edc8ba-c078-4b87-97a7-a291ed388387-0 So if you get an error that you're expecting or that you're 08edc8ba-c078-4b87-97a7-a291ed388387-1 that you want to back off on, you can retry. cbac430f-267b-4365-bc03-8b0d81643d8e-0 We also need to develop a suite of exceptions and. b85b0c26-3965-4ba6-a240-a3cc7ec6322f-0 A response codes that you have specific handlers for. eca102d5-73fe-45c9-9ae9-5c49db437bf2-0 So if you're getting rate limit to back off, if you get an error eca102d5-73fe-45c9-9ae9-5c49db437bf2-1 you're not expecting, you can retry and that sort of thing. 91d9e373-a1ea-4610-834a-7dd38a0cfe2f-0 And all of these things need to be built into all the different 91d9e373-a1ea-4610-834a-7dd38a0cfe2f-1 layers of your distributed application. 9e7de5a0-f14c-4edf-853c-8ca5a490328f-0 OK, so with all of those, all of those risks in mind, what are 9e7de5a0-f14c-4edf-853c-8ca5a490328f-1 the mitigations look like potentially for anon cadence 9e7de5a0-f14c-4edf-853c-8ca5a490328f-2 solution? 0cec3509-dbc7-41a6-83aa-d73da1e7e3f5-0 And this will sort of go into our native solution code in a 0cec3509-dbc7-41a6-83aa-d73da1e7e3f5-1 second. 4eb82f83-d55c-4723-9c13-abd534b2299b-0 So if we take the previous diagram that I showed you and we 4eb82f83-d55c-4723-9c13-abd534b2299b-1 actually start thinking about how we're going to implement it 4eb82f83-d55c-4723-9c13-abd534b2299b-2 in a native Java or it doesn't have to be Java, it could be any 4eb82f83-d55c-4723-9c13-abd534b2299b-3 application really. 88d3e184-aa5b-4f93-92f0-4a6de6cdd0ba-0 You can see here on the left. 19cc58b1-5a6b-4393-b0a4-5e9c222ce014-0 Instead, we have a customer creating an order as usual, but 19cc58b1-5a6b-4393-b0a4-5e9c222ce014-1 instead of sending it straight to a service, we're going to 19cc58b1-5a6b-4393-b0a4-5e9c222ce014-2 have it buffered in rabid MQ and this and the restaurant service 19cc58b1-5a6b-4393-b0a4-5e9c222ce014-3 will pull that particular queue when it's ready to process the 19cc58b1-5a6b-4393-b0a4-5e9c222ce014-4 next order and then do the same work. 972684e2-6d80-49aa-869e-49ee7c0b32bf-0 And then similarly it will when we're trying to schedule a 972684e2-6d80-49aa-869e-49ee7c0b32bf-1 delivery, we will again queue that in a rabbit M queue. de26a8b6-9c7a-47e5-9327-614a655fcea6-0 And the delivery service will be pulling the queue as quickly as de26a8b6-9c7a-47e5-9327-614a655fcea6-1 it can reasonably be able to handle this the load that it de26a8b6-9c7a-47e5-9327-614a655fcea6-2 has. 67ccbd8f-4465-4fb8-9ae2-ee4e1fba61f3-0 And then all the while, all of these services, all three of 67ccbd8f-4465-4fb8-9ae2-ee4e1fba61f3-1 them will be persisting a state in a Postgres database. 41913428-6130-4c58-b3dd-87a9c7353413-0 So when we create an order, we'll create a record for that 41913428-6130-4c58-b3dd-87a9c7353413-1 and store it in Postgres. 0da92959-7c8a-4746-8b63-83cce60968d8-0 When we're cooking an order, again, we'll be persisting that 0da92959-7c8a-4746-8b63-83cce60968d8-1 in Postgres. aba6973d-4a73-4212-9027-b75d049d5725-0 And each of these services will be talking to Postgres to update aba6973d-4a73-4212-9027-b75d049d5725-1 the state and to progress the state. 293afe64-2d16-4c11-8981-84775afb1e8d-0 And we'll have anumber of different models in our database 293afe64-2d16-4c11-8981-84775afb1e8d-1 representing thevarious different orders and order 293afe64-2d16-4c11-8981-84775afb1e8d-2 statuses. 4d66536c-98c2-40e3-b7de-e4d70289563b-0 OK, now I'm going to switch over to our code. 4af9c0ba-5844-4f61-acd9-3584f95dba43-0 So how might this look in a native solution? 29bae22a-4227-412d-85c3-c2940faf7f15-0 Now I'm going to switch over to code. 8005bff9-ff5d-4169-a430-757c94a3a5c1-0 Just let me know if this still looks good. 1a826909-92f4-417b-807e-211003767236-0 And I'm going to just quickly open up just increase this as 1a826909-92f4-417b-807e-211003767236-1 big as we can. dded1d6a-eda4-44b3-bab4-41e5d8ab7c66-0 Anthony, does that still look good? 210fa3c4-a595-4ba9-a276-3c521288617a-0 Can you read that? eb98aac3-bfdf-4c3f-9b52-2feda358d76b-0 Yep, all good. aff2d169-7d38-49f1-a991-6c2aea07edf9-0 Awesome. b17acbfc-d1d8-4dd6-a626-d8740a3682df-0 All right, so I'm going to try and just gloss over the bits you b17acbfc-d1d8-4dd6-a626-d8740a3682df-1 don't need to worry about in here. 52b2ffe3-7a6d-4545-b545-2128dff67ac9-0 We have a Java application with three main parts which 52b2ffe3-7a6d-4545-b545-2128dff67ac9-1 represent, which again represent the three main sections that we 52b2ffe3-7a6d-4545-b545-2128dff67ac9-2 were talking about with our diagram. ae5a3489-a74a-4b43-8e5e-47bc54ff49eb-0 We're going to quickly look at the first section, which is our ae5a3489-a74a-4b43-8e5e-47bc54ff49eb-1 dispatcher, which I'm calling. 29962a5b-3f47-46d4-b6d0-a06550a775bb-0 That's the overarching thing responsible for creating orders 29962a5b-3f47-46d4-b6d0-a06550a775bb-1 and dispatching the delivery drivers. 18d0b4ec-5be7-4342-9878-ddac7bd72225-0 And the first thing we have here might just minimise that 18d0b4ec-5be7-4342-9878-ddac7bd72225-1 slightly. 9888fee9-e644-4afb-b076-00d3aaf6bec4-0 I'll just get rid of some of this so we can see it in order. 8f947f76-da40-4c35-a91c-09cc3e4c7283-0 So what we have here is so we're on the other end of the client 8f947f76-da40-4c35-a91c-09cc3e4c7283-1 that has created a request. 0a3bd526-c632-48c1-82b9-44a66ad20163-0 And we have to do a number of things when we're setting up a, 0a3bd526-c632-48c1-82b9-44a66ad20163-1 a queue here to then listen on and then send off an order. faeccda2-01f7-466c-9fea-d4096dd593a7-0 So again, don't worry too much if you can't follow along faeccda2-01f7-466c-9fea-d4096dd593a7-1 exactly. 3270eecd-58d0-48c8-9aab-0a4b5f7a88c6-0 I will point out the things that are of a specific interest. 3b082497-5d09-49d3-94a9-500cbaf0eef5-0 So because we're working with Rabbit MQ, we need to set up our 3b082497-5d09-49d3-94a9-500cbaf0eef5-1 Rabbit MQQ name and then we have a bunch of connection strings 3b082497-5d09-49d3-94a9-500cbaf0eef5-2 and we don't have to worry too much about it of what we're 3b082497-5d09-49d3-94a9-500cbaf0eef5-3 going to be doing. e0e1f1f6-79d6-4c98-ac72-0a3411d15640-0 We're going to be listening to a queue and waiting for an order. 9296df7f-fc02-4715-990d-6c08150c6b67-0 OK, so all of this connection detail here is just to set up a 9296df7f-fc02-4715-990d-6c08150c6b67-1 Rabbit MQ connection. 347df1d8-7979-439a-ba70-45eddcc153af-0 Now in a, in a production environment, we probably would 347df1d8-7979-439a-ba70-45eddcc153af-1 be offloading this into a separate function or some 347df1d8-7979-439a-ba70-45eddcc153af-2 attributes or something, but it doesn't really matter at this 347df1d8-7979-439a-ba70-45eddcc153af-3 point. 837778a4-e9ef-4508-a0c6-ee9ec0ddcc5a-0 I just want to put all there because that's the code that's 837778a4-e9ef-4508-a0c6-ee9ec0ddcc5a-1 necessary. f4bdb0c8-6bde-4338-9c86-b8be18ab2c7a-0 And then finally what'll be happening is this. 3fdf6151-0f67-4c9e-b795-660248fd1107-0 Then this could be a multi threaded solution. 91647258-ce75-4842-8177-9c164815ecdd-0 So each of these threads will be listing on the queue and then 91647258-ce75-4842-8177-9c164815ecdd-1 when a request comes in that it has capability to handle, it 91647258-ce75-4842-8177-9c164815ecdd-2 will read the message off the queue which has the order. 22762367-2132-49a5-acdb-a99376b9ea4b-0 It will create a new food order and then it'll call out order 22762367-2132-49a5-acdb-a99376b9ea4b-1 food function. 40caeedb-2f51-4d3a-86d4-a577c29de3c1-0 OK, very simple, but we have all of this code set up just to 40caeedb-2f51-4d3a-86d4-a577c29de3c1-1 listen on the rabbit MQQ and then create a food order. af8b8881-08c4-4abe-99a5-42041d14e9e7-0 And we're going to Scroll down and this order food function is af8b8881-08c4-4abe-99a5-42041d14e9e7-1 responsible for then dispatching our order, translating it into af8b8881-08c4-4abe-99a5-42041d14e9e7-2 an order that the restaurant can understand and then sending that af8b8881-08c4-4abe-99a5-42041d14e9e7-3 to a separate service. b4d4d08c-4c8c-47ba-8719-56dc1e734e5b-0 OK. bd418cd5-d3bf-4494-bde7-4f3485bbddce-0 Now when we look at this, at this particular instance, we bd418cd5-d3bf-4494-bde7-4f3485bbddce-1 just have one restaurant that we support, which is called bd418cd5-d3bf-4494-bde7-4f3485bbddce-2 Megabuck. cfea6ac9-dd8a-4efa-a446-d3e0cc30a0c1-0 The Insta food app has only just started. 5747f3f2-1d89-4c5e-9f68-ae6d50a8bbfd-0 We've got one partner restaurant. 31f354e7-d3f3-458b-bd7c-eaa5ccc095eb-0 We do anticipate we're going to be onboarding a number of 31f354e7-d3f3-458b-bd7c-eaa5ccc095eb-1 different restaurants in the future. 5469442c-eb85-4873-8057-bd60344306fb-0 And if we do, instead of having a simple if statement to say, 5469442c-eb85-4873-8057-bd60344306fb-1 you know, whether it's mega burger or otherwise, we don't 5469442c-eb85-4873-8057-bd60344306fb-2 know, we will potentially have a switch statement where we're 5469442c-eb85-4873-8057-bd60344306fb-3 introducing a number of different restaurants. 9dad5a70-f836-40c5-bed0-be90241a9efb-0 Each of those restaurants will handle their orders slightly 9dad5a70-f836-40c5-bed0-be90241a9efb-1 differently. e107524f-95d1-4ccd-8fd9-78589fea06f3-0 They'll need a different set of information. 45ef939d-4463-4aaa-854c-aaf41a64c2ee-0 We'll need to translate the insta food order into an order 45ef939d-4463-4aaa-854c-aaf41a64c2ee-1 that this restaurant can understand. c920ce53-ec12-4772-9062-84d2f2cd0813-0 And that's the logic that you're seeing here. cce4b859-877c-4193-aee8-c712b94bf7bd-0 What finally happens is these orders are placed on a Rabbit MQ cce4b859-877c-4193-aee8-c712b94bf7bd-1 service in this create order function and the downstream cce4b859-877c-4193-aee8-c712b94bf7bd-2 service that is listing on this queue, which in this case will cce4b859-877c-4193-aee8-c712b94bf7bd-3 be amega burger service will be able to then handle the cce4b859-877c-4193-aee8-c712b94bf7bd-4 request and then start the process ofcooking and cce4b859-877c-4193-aee8-c712b94bf7bd-5 preparing the meal. e446d1bb-9e01-40ae-9ccc-094532e47d62-0 OK, so, but you can see here that after we've ordered the e446d1bb-9e01-40ae-9ccc-094532e47d62-1 food, thisfunction returns and essentially it will release e446d1bb-9e01-40ae-9ccc-094532e47d62-2 the thread and there will be no that that'll be the,e446d1bb-9e01-40ae-9ccc-094532e47d62-3 job of the dispatcher is complete. 139bb0a4-8416-4be4-9e26-7a54e97af469-0 But you can see in our, you can remember in our diagram, we had 139bb0a4-8416-4be4-9e26-7a54e97af469-1 a number of different steps we needed to follow up on. 76cbc198-5739-4a89-9109-b3cc89014b38-0 We needed to understand what the ETA of the order is so that we 76cbc198-5739-4a89-9109-b3cc89014b38-1 can inform the customer about when their food isdetermined 76cbc198-5739-4a89-9109-b3cc89014b38-2 to be ready and then when it will be delivered. 728c9686-bd09-4866-9c70-9beb683fb49e-0 And we use the ETA to inform our Courier service of when to 728c9686-bd09-4866-9c70-9beb683fb49e-1 dispatch the Courier and pick up the order. 6c8a0318-3fe4-4726-b082-9a7945e37be5-0 OK, so how can we possibly track that in a native Java 6c8a0318-3fe4-4726-b082-9a7945e37be5-1 application? f3588341-498c-4d27-b7e0-cc85b9581e1b-0 Well, remember we were persisting the state in the f3588341-498c-4d27-b7e0-cc85b9581e1b-1 database. 8727280d-d060-4c02-96e8-95eaa0fe9178-0 So separate to our Rabbit MQ service that we have here that's 8727280d-d060-4c02-96e8-95eaa0fe9178-1 listening and dispatching the orders to the relevant 8727280d-d060-4c02-96e8-95eaa0fe9178-2 food restaurants, we need another service that is going to 8727280d-d060-4c02-96e8-95eaa0fe9178-3 be responsible for updating the in flight orders. a48f42de-77aa-4aad-8e1b-415380aa7bdb-0 And I've left that in the same inthis region here, which is a48f42de-77aa-4aad-8e1b-415380aa7bdb-1 in the same function but or in the same class. 71a1f229-e9a4-46b1-b6e4-a348142d4580-0 But ordinarily you probably have this in a separate class that is 71a1f229-e9a4-46b1-b6e4-a348142d4580-1 running in a separate instance. 476b31d7-4ae5-4a8f-9c28-e6b76e303e3d-0 And what it's responsibility is,to read the order persistence 476b31d7-4ae5-4a8f-9c28-e6b76e303e3d-1 and handle the state changes inside. f5fcd1a6-ec67-46d6-9ab5-8d7b902f7f6f-0 So if you can see here what we have and you maybe eminently f5fcd1a6-ec67-46d6-9ab5-8d7b902f7f6f-1 familiar with this pattern because it is fairly common when f5fcd1a6-ec67-46d6-9ab5-8d7b902f7f6f-2 you're developing a state machine that you can't leave a f5fcd1a6-ec67-46d6-9ab5-8d7b902f7f6f-3 thread open forever. 7db3de75-1a6a-4cd0-b31a-35b38b8cb7f6-0 You will often have a,something like this where you're 7db3de75-1a6a-4cd0-b31a-35b38b8cb7f6-1 retrieving all of the models out of the database and 7db3de75-1a6a-4cd0-b31a-35b38b8cb7f6-2 then tracking as the state's progress what you need to do in 7db3de75-1a6a-4cd0-b31a-35b38b8cb7f6-3 the next step. 011f9996-81e0-4e96-a0d4-4d7a10acbd45-0 So we have a, we'll have another service outside that is updating 011f9996-81e0-4e96-a0d4-4d7a10acbd45-1 the status of these things, but we need our dispatcher to be 011f9996-81e0-4e96-a0d4-4d7a10acbd45-2 able to do the right thing when thetime comes. 79b94685-a44f-4f7a-bd70-56d9f946e036-0 So for example, if our, if our Megaburger order was created, 79b94685-a44f-4f7a-bd70-56d9f946e036-1 it's returned. 15c22b23-5b0e-4849-9b4c-42621b705dc9-0 But let's say it goes to our Megas service and the Megaburger 15c22b23-5b0e-4849-9b4c-42621b705dc9-1 service says, oh, we actually don't have any more of that 15c22b23-5b0e-4849-9b4c-42621b705dc9-2 particular order and it rejects the order. 2e9a19dd-9f83-4420-bb86-7ed78a7f68d7-0 How would we be able to update the customer? 5ffb2c69-5fc6-4bf2-b964-a2888e4f3704-0 Well, with this order handler when it's polling the database, 5ffb2c69-5fc6-4bf2-b964-a2888e4f3704-1 it would be able to then read out the currently persisted in 5ffb2c69-5fc6-4bf2-b964-a2888e4f3704-2 flight orders, see that thecase the order has been rejected 5ffb2c69-5fc6-4bf2-b964-a2888e4f3704-3 and then it can invoke the correct notification service to 5ffb2c69-5fc6-4bf2-b964-a2888e4f3704-4 notify the customer. 5834427c-fbef-4821-a805-fa5790be8276-0 Now this notification isn't,realistically going to be 5834427c-fbef-4821-a805-fa5790be8276-1 able to be handled by the mega burger service because we'll 5834427c-fbef-4821-a805-fa5790be8276-2 have again, we could have, you know, 10 to 15 to 20 to 100 5834427c-fbef-4821-a805-fa5790be8276-3 different restaurants. 91acd3ed-b5ad-456c-bc3b-79be75316a11-0 Not we wouldn't expect every single restaurant service to 91acd3ed-b5ad-456c-bc3b-79be75316a11-1 implement its own notification service. 377b3d34-18f1-426e-a5b7-f21e26d04190-0 It's going to be inefficient way to do things. 7685beb3-bfcb-4523-8552-fa3395f69ecb-0 And we want to have it all centralised in a single place. 3f233c6d-0cfa-46dd-8698-56f947e56bd3-0 So it makes sense for the dispatcher to be responsible for 3f233c6d-0cfa-46dd-8698-56f947e56bd3-1 this. 11e7d31e-57fb-4eeb-93d9-648d751ef0cd-0 But the only way you can realistically know about the 11e7d31e-57fb-4eeb-93d9-648d751ef0cd-1 state changes is if it informs if it can read the database and 11e7d31e-57fb-4eeb-93d9-648d751ef0cd-2 inform the customer. 9d87905d-3465-4d9f-98c4-af384a5be54e-0 And similarly, when it needs to know how to dispatch an order, 9d87905d-3465-4d9f-98c4-af384a5be54e-1 it needs to know when an order is ready. b0241cfc-e175-45ef-a8ba-142171690658-0 It should dispatch a Courier and then it can start a, it can send b0241cfc-e175-45ef-a8ba-142171690658-1 a message to Rabbit MQ to dispatch an order. 80e018ad-fd05-4c7e-8ea8-d33e4641b243-0 And then it needs to again have all the order details so it can 80e018ad-fd05-4c7e-8ea8-d33e4641b243-1 know thephone number and the address of the customer. 524bde1d-2ba7-427b-afac-4b002354ad83-0 So again, we have so we have two parts to this solution. 38073890-ccc9-410f-99d1-f2055cf4e31f-0 We have a the side that is listening on a queue and 38073890-ccc9-410f-99d1-f2055cf4e31f-1 and performing the work. 31b616c5-0748-4f33-9773-efebb1bafc75-0 And then we have a essentially a looping mechanism that will go 31b616c5-0748-4f33-9773-efebb1bafc75-1 in and track the in flight orders and react to when the 31b616c5-0748-4f33-9773-efebb1bafc75-2 states get updated. 89bb5958-1beb-4c75-bca3-9b0bde0b2287-0 So two things that are running sort of in parallel and they 89bb5958-1beb-4c75-bca3-9b0bde0b2287-1 need to be able towork in harmony. 0d96cd97-6be8-4fd0-9ccf-ffb7bbcf7581-0 So we're going to just quickly jump over to what is the mega 0d96cd97-6be8-4fd0-9ccf-ffb7bbcf7581-1 burger service look like? 71ec8ad6-cb54-4afd-9f3b-dc1c1cc448c8-0 And it is almost identical, right? aac9436e-48fb-4836-b80b-cdaf638332cc-0 So it listens for an order on the Rabbit MQQ and then it aac9436e-48fb-4836-b80b-cdaf638332cc-1 creates an order to the Mega Burger APIs. bd7557aa-8f76-4dc6-876b-732f030e6847-0 Now again, this is our downstream API, our third party bd7557aa-8f76-4dc6-876b-732f030e6847-1 API, which may or may not be available. d00ecdf6-9ad1-4fdf-bc5c-350c43ea041a-0 And you can see here, you can start to imagine here what we d00ecdf6-9ad1-4fdf-bc5c-350c43ea041a-1 might, what might happen if this create order, if this API fails. 3c72a2ae-4fdc-420b-b5e8-09e0e8f14ca1-0 How do we handle that? d5ec400d-8687-435b-8b53-d1287053c800-0 In this particular example, we're not handling it and it's d5ec400d-8687-435b-8b53-d1287053c800-1 just to demonstrate that if you do rely on these downstream d5ec400d-8687-435b-8b53-d1287053c800-2 third party APIs that you really do need to make sure you're d5ec400d-8687-435b-8b53-d1287053c800-3 handling what their flaking is essentially. 4f4cc963-0b2d-4633-b29b-b474b6374aa4-0 So in this, in this example, we're assuming that the create 4f4cc963-0b2d-4633-b29b-b474b6374aa4-1 will work and we'll get an ID back. 40d3ccf2-331f-4a9b-8511-d3886d779cf4-0 We're thinking it's a synchronous call and it'll at 40d3ccf2-331f-4a9b-8511-d3886d779cf4-1 least give us an ID and it will then will create a record in our 40d3ccf2-331f-4a9b-8511-d3886d779cf4-2 database with an order ID and we'll give it a status. db3acc20-17b7-4b4a-af54-0a295737fc52-0 And that is how we're persisting in the state. f0465cf0-9ab0-4df7-9e87-d36b054a1ac9-0 And then again, this function will return instantly and then f0465cf0-9ab0-4df7-9e87-d36b054a1ac9-1 be able to create another request off the rabbit MQQ. 1f03464e-8310-4d91-8af9-8700808b59be-0 And I'm just going to go over this really quickly, but this 1f03464e-8310-4d91-8af9-8700808b59be-1 again, each order has to be able to, so each order in Mega Burger 1f03464e-8310-4d91-8af9-8700808b59be-2 needs to be persisted. 7859a540-451e-44fc-ae05-fb1a659435ee-0 And we again, we need to poll the status out ofthe 7859a540-451e-44fc-ae05-fb1a659435ee-1 database and compare that to what the status is on the Mega 7859a540-451e-44fc-ae05-fb1a659435ee-2 Burger side. 448e1acb-65a4-46ee-a0c1-58670af05555-0 So this service is will get all of the in flight orders and 448e1acb-65a4-46ee-a0c1-58670af05555-1 check the status that it is in the database and then check the 448e1acb-65a4-46ee-a0c1-58670af05555-2 status against the third party API. f7d26ff8-df23-430f-9d5d-bcd34bd9df44-0 So Mega Burger, we have a pending order. 0409c4b4-4663-4979-9c3c-bb0037c54cd0-0 We expect we get that out of the database. 4a9b05ab-4153-45c4-999a-78ba08f11aa6-0 We check with Mega Burger. 0f18850b-f852-4f40-99cf-c5ae3e336f7e-0 Is this still pending? e0ec4162-395e-40bd-b69b-7e715b32fed2-0 No, it's been accepted. f4b466ac-f2d8-49ec-af51-8c2f94525fd4-0 Great. fc510ba9-ae46-4011-b88a-fd5d856f1b07-0 We'll update the status and then back in the dispatcher, it will fc510ba9-ae46-4011-b88a-fd5d856f1b07-1 see the status update and then inform the customer and finally fc510ba9-ae46-4011-b88a-fd5d856f1b07-2 the delivery. 709d3264-f90e-4f01-a9d1-35591aa46cd1-0 Again, we have a very similar, I've come and said all out to 709d3264-f90e-4f01-a9d1-35591aa46cd1-1 test something, but again, we have the exact same scenario is 709d3264-f90e-4f01-a9d1-35591aa46cd1-2 thepattern is repeated again is we have a third party 709d3264-f90e-4f01-a9d1-35591aa46cd1-3 API. 0b38c7ca-651d-4751-93b0-efca4e7d5751-0 We need to pull the status, we need to make sure it's updated 0b38c7ca-651d-4751-93b0-efca4e7d5751-1 and we need to be informing the downstream application. db1e2643-2054-4574-a67c-2a8a11725a4b-0 Now this is just one way that you could approach this db1e2643-2054-4574-a67c-2a8a11725a4b-1 solution. 77d389c0-1d5e-4ad7-9235-5f64d6e76e49-0 You can see here we have a number of different domain 77d389c0-1d5e-4ad7-9235-5f64d6e76e49-1 models which represent the orders that are being persisted 77d389c0-1d5e-4ad7-9235-5f64d6e76e49-2 in the database. e0737f78-edfd-4e8f-bd5a-1f75382a093d-0 We have again, anothermodel which is sort of the mega e0737f78-edfd-4e8f-bd5a-1f75382a093d-1 burger order. e8e9848e-867d-4f64-a792-1a4987c95553-0 All of this stuff needs to be persisted in a database. 6d1a9c10-5363-4667-8d7b-c2bd3ba19a50-0 We need to have a model in our code base and we need to be 6d1a9c10-5363-4667-8d7b-c2bd3ba19a50-1 tracking it in Postgres. 9d08f373-b31c-4de8-b2f5-41f4fa60dd5a-0 And we have a,downstream requirement that Postgres or,9d08f373-b31c-4de8-b2f5-41f4fa60dd5a-1 whatever persistence layer that we're going to be using is there 9d08f373-b31c-4de8-b2f5-41f4fa60dd5a-2 and it's going to be working. 57ee53a0-6063-493f-a77d-8b2eb7dddcf0-0 So that's a high level understanding of how a Java 57ee53a0-6063-493f-a77d-8b2eb7dddcf0-1 application could look. 6c84b12b-2e94-42ba-a269-5e07001562db-0 Again, it may look familiar. dbfc16ce-1d45-4f91-b678-a5b9e3aa22af-0 This particular partner in,particularly could be dbfc16ce-1d45-4f91-b678-a5b9e3aa22af-1 familiar to some people when you're distributing an dbfc16ce-1d45-4f91-b678-a5b9e3aa22af-2 application across a number of different services that don't dbfc16ce-1d45-4f91-b678-a5b9e3aa22af-3 have ways to talk directly to each other and you need to be dbfc16ce-1d45-4f91-b678-a5b9e3aa22af-4 releasing threads to in order to be as efficient as possible. f763225a-6ceb-495e-aa9e-96adde1e4af9-0 You may have something that looks like this for a state f763225a-6ceb-495e-aa9e-96adde1e4af9-1 machine. 9e1447da-9815-4df5-83c9-6501e87409c9-0 And this is a fairly common approach. cc201d0a-58b3-42f3-be40-fb371fc2a474-0 It's not the only way again, but let's see how we might be able cc201d0a-58b3-42f3-be40-fb371fc2a474-1 to do this in when using Cadence. 75721b07-ce06-4b5b-bf50-d29c5ded6f5d-0 So I'm going to switch back to the slides and here's a just a 75721b07-ce06-4b5b-bf50-d29c5ded6f5d-1 diagram just to highlight, you know, some of the 75721b07-ce06-4b5b-bf50-d29c5ded6f5d-2 design concepts that we had for our native solution. 3f727dfe-8384-4f0a-8c7f-0c21c2a2a5ec-0 Again. 145d447b-48ef-4116-9e59-2062ad35a1e6-0 So we have the orders being sent in and then we have under 145d447b-48ef-4116-9e59-2062ad35a1e6-1 separate service so that you can't really see that spins 145d447b-48ef-4116-9e59-2062ad35a1e6-2 across the database to get the state and then updates some of 145d447b-48ef-4116-9e59-2062ad35a1e6-3 the downstream functions. 8ff85913-a687-4f72-a632-454a15fc035d-0 So we saw the service sort of at a broad level, but what some of 8ff85913-a687-4f72-a632-454a15fc035d-1 the questions that we should ask ourselves is howcan these 8ff85913-a687-4f72-a632-454a15fc035d-2 services scale? fc61611c-a258-4efc-a699-8eb2eef05953-0 So eventually, as I mentioned, we're going to be on boarding a fc61611c-a258-4efc-a699-8eb2eef05953-1 bunch of different restaurants in our Java approach, we have fc61611c-a258-4efc-a699-8eb2eef05953-2 that, we have that currently an if statement and there may be a fc61611c-a258-4efc-a699-8eb2eef05953-3 switch statement. 04c50ab9-bc26-4543-afb3-75efe6006cd3-0 But essentially what it means every time we add a new 04c50ab9-bc26-4543-afb3-75efe6006cd3-1 restaurant or a new customer, we may be needing to update that 04c50ab9-bc26-4543-afb3-75efe6006cd3-2 core dispatch logic, which would potentially mean that, you know, 04c50ab9-bc26-4543-afb3-75efe6006cd3-3 in flight operations could be affected. 4f33cf25-ccf9-4cfc-99e0-291a8ff184a8-0 We need to figure out ways to mitigate that. 5236c5b9-f3b5-4646-9c13-9ad250b5f3d7-0 We would need to be making constant updates when service 5236c5b9-f3b5-4646-9c13-9ad250b5f3d7-1 signatures fail and stuff like that. c819c2d2-4357-4948-b97f-74f5ad2f05f4-0 So we have ahuge dependency on updating the code base when c819c2d2-4357-4948-b97f-74f5ad2f05f4-1 we're trying to onboard new customers and we ideally want c819c2d2-4357-4948-b97f-74f5ad2f05f4-2 ways away from that. ef32b864-87ee-44d5-83dc-d2f6373f4991-0 Andanother thing is if we go back to this example, when we ef32b864-87ee-44d5-83dc-d2f6373f4991-1 have a service that is reading the database to ought to get the ef32b864-87ee-44d5-83dc-d2f6373f4991-2 state updates and make the downstream servicer calls. 7cdb7ff3-6aac-478b-8709-ee32408c4b2c-0 How can we potentially scale this up? de3683c4-b22e-4297-b087-24ac011f4fe8-0 So if we have thousands and thousands of orders in the de3683c4-b22e-4297-b087-24ac011f4fe8-1 database and this inflow order handler, it can't process them de3683c4-b22e-4297-b087-24ac011f4fe8-2 fast enough to for it to be on time delivery and for our de3683c4-b22e-4297-b087-24ac011f4fe8-3 customers to update it. 4a132137-6667-4226-b438-dc9ec551dc15-0 So how can we make multiples of this service that is responsible 4a132137-6667-4226-b438-dc9ec551dc15-1 for updating thestates? a53efeb9-aac6-4252-ab4a-9820e1b3f194-0 Well, if we were just to set up a separate instance of this a53efeb9-aac6-4252-ab4a-9820e1b3f194-1 exact same thing, then we might when we're going to start double a53efeb9-aac6-4252-ab4a-9820e1b3f194-2 handling the same request. 7d013952-6d62-4d33-a481-b40122a9f097-0 So if you can imagine these two services spinning on the same 7d013952-6d62-4d33-a481-b40122a9f097-1 Postgres database, we may be reading the same row and then 7d013952-6d62-4d33-a481-b40122a9f097-2 updating the same thing twice. a60dfc07-b755-44ba-9e11-906a8ba8a2e0-0 So we would then again, need to have somewhere to either lock a60dfc07-b755-44ba-9e11-906a8ba8a2e0-1 rows, which could lead to deadlocks, or wemight need a60dfc07-b755-44ba-9e11-906a8ba8a2e0-2 to Shard out each,instance will have a,subset of these a60dfc07-b755-44ba-9e11-906a8ba8a2e0-3 things. bb469320-38c1-4548-a112-0c59c2e9583a-0 And that's more logic that you need to be building into your bb469320-38c1-4548-a112-0c59c2e9583a-1 system, more things that you need to be testing and just bb469320-38c1-4548-a112-0c59c2e9583a-2 cognitive load that you need to undertake in order to,scale bb469320-38c1-4548-a112-0c59c2e9583a-3 out this sort of naive solution into a proper distributed bb469320-38c1-4548-a112-0c59c2e9583a-4 application. 824c4b54-e279-4446-9e6a-525294b7738d-0 So that was again, a sort of a whirlwind tour. 9ee63020-e4c0-45ef-91d7-9851b566efbd-0 But how,can, how can cadence help us with a solution 9ee63020-e4c0-45ef-91d7-9851b566efbd-1 like that? c485da76-d84a-4bb6-bb98-69fabe646fab-0 And how can we sort of compare against what a native solution c485da76-d84a-4bb6-bb98-69fabe646fab-1 might look like compared with cadence? 25dfe248-0844-43ce-9483-5c6af23d2587-0 So cadence it looks, so this solution is how it might look 25dfe248-0844-43ce-9483-5c6af23d2587-1 with Cadence and it's very similar to how we saw with25dfe248-0844-43ce-9483-5c6af23d2587-2 Rabbit MQ and Postgres. c6e1d678-469f-4ee4-8626-f7c65f2b7588-0 But you can see here that we don't see the persistence layer. 70264c7c-f5bb-4184-b4c2-afba45dd4583-0 And again, that's completely by design. cf575b59-55c8-4b4e-9ce8-f7bce8ba408b-0 Cadence sits in front of it's persistence layer. a969c690-b397-4a3f-a486-fd37a0477199-0 So it's invisible to the developers and the users, but a969c690-b397-4a3f-a486-fd37a0477199-1 the paradigms are still basically the same. 44c9a10f-021e-4123-b985-c47d0898e946-0 You still understand how it works. 16370dd6-734f-4f04-94af-d614596ed0bc-0 So a customer creates an order that gets sent to the Cadence 16370dd6-734f-4f04-94af-d614596ed0bc-1 application and we have this concept of a worker now. d88f8672-edea-4736-b2e6-4622b49ee72e-0 And you can see here in the yellow, sorry, in the orange box d88f8672-edea-4736-b2e6-4622b49ee72e-1 is sort of the, I'm calling it the dispatch workflow. d7fcef44-9f0a-4307-8a72-52522773e968-0 You can also call it a parent workflow. 1e2cb31e-fa5e-4b5e-8acd-f628216a424a-0 And the way that these workflows work is they are operations that 1e2cb31e-fa5e-4b5e-8acd-f628216a424a-1 sit on a server somewhere and they're listening to a queue and 1e2cb31e-fa5e-4b5e-8acd-f628216a424a-2 they're polling a queue. 1b81f4b7-f9fc-4248-9729-b52b81b4e321-0 And if there's no work to be done, then the worker obviously 1b81f4b7-f9fc-4248-9729-b52b81b4e321-1 does nothing. c8bcb21a-af5f-449b-a993-557d978e3043-0 But as soon as this order is created in Cadence, then we will c8bcb21a-af5f-449b-a993-557d978e3043-1 grab the work off the queue just like we would have Rabbit MQ, c8bcb21a-af5f-449b-a993-557d978e3043-2 except we don't have to manage the queue ourself. f21558c4-9451-4252-8b63-2f93ebd0bb15-0 That's actually handled by Cadence. 413fa031-1a8f-4181-be07-63c55dfd9fb5-0 We just tell it what we're listening for. 0167582e-0307-4516-aa7d-f32aa3842410-0 In this particular instance, we're going to be dispatching 0167582e-0307-4516-aa7d-f32aa3842410-1 that order to another workflow. 48bbbc47-a0f3-4d00-9842-8c06f883dbc1-0 And in this green box is where the restaurant workflow will 48bbbc47-a0f3-4d00-9842-8c06f883dbc1-1 listen to and then start the work ofdoing theorder 48bbbc47-a0f3-4d00-9842-8c06f883dbc1-2 preparation and similarly with the delivery. 5de4114e-5d84-45c4-9432-aee6959bc972-0 Now, the main difference between this approach and the one we saw 5de4114e-5d84-45c4-9432-aee6959bc972-1 in the native solution, there's two main things I want to call 5de4114e-5d84-45c4-9432-aee6959bc972-2 out. b85926bb-5627-4682-8fbb-284cc98d79c1-0 Again, we don't have to persist any state, and I'll go into how b85926bb-5627-4682-8fbb-284cc98d79c1-1 that actually works in a second, but you can see here, we're not b85926bb-5627-4682-8fbb-284cc98d79c1-2 dealing with Postgres. 95247583-a3a8-47b3-8215-e56101eb73fc-0 So immediately we don't have to worry about Postgres database. e7a623cd-fcd3-41f5-8a6f-582ac15204d8-0 We don't have to worry about the data models. 56a85a29-166b-4620-921e-71deb16fc3e3-0 We've got rid of any ORMS or any logic we have to manage our 56a85a29-166b-4620-921e-71deb16fc3e3-1 database models. 812cb6bc-897a-4aae-99cf-0fb4d56c039d-0 All of that has gone away. bfe45e6a-414b-4d53-9dc1-847be2bd966e-0 We're just dealing directly with Cadence and Cadence can handle bfe45e6a-414b-4d53-9dc1-847be2bd966e-1 most models sort of inherently without actually having to think bfe45e6a-414b-4d53-9dc1-847be2bd966e-2 about it. 43966b19-b02c-44a8-b2bf-d38db8ea1d7c-0 The other thing, the other core difference is the parent 43966b19-b02c-44a8-b2bf-d38db8ea1d7c-1 workflows actually have context and pointers to the child 43966b19-b02c-44a8-b2bf-d38db8ea1d7c-2 workflows that they're creating. e50619f6-e375-4dd4-b851-d556c670a3b9-0 And I'm going to call this out in a second, but that allows a e50619f6-e375-4dd4-b851-d556c670a3b9-1 direct relationship between in flight operations to be able to e50619f6-e375-4dd4-b851-d556c670a3b9-2 talk to each other in an asynchronous manner. 6d47001d-b1ce-4820-a1cd-ef1b08235b75-0 But it means that you don't have to persist state ina third 6d47001d-b1ce-4820-a1cd-ef1b08235b75-1 party. 93b51def-c8fc-492a-a285-f461cabc3089-0 You can actually talk directly to the workflow that you're 93b51def-c8fc-492a-a285-f461cabc3089-1 dealing with. 814c370d-27c5-43a0-9b10-cdef2ef61dc9-0 So for example, when the restaurant starts cooking a an 814c370d-27c5-43a0-9b10-cdef2ef61dc9-1 order, it can then persistent and it can store an ETA and then 814c370d-27c5-43a0-9b10-cdef2ef61dc9-2 send that ETA directly to the parent workflow. e6592a5e-adab-4cbe-a7cb-843592e15165-0 And the parent workflow can have a signal receiver that can e6592a5e-adab-4cbe-a7cb-843592e15165-1 understand what that ETA is. a1f6ba13-b36c-4d09-8a29-6fa6fcc03df0-0 And thatnumber, that ETA doesn't actually leave the a1f6ba13-b36c-4d09-8a29-6fa6fcc03df0-1 context of this workflow. e8457b71-97c5-49f9-98a7-31325bf08fda-0 It's all self-contained. 36875362-43b9-4d0d-b309-e954b3cbc171-0 We don't have any. a1cb5579-1413-4753-bdc0-0467278bb3c0-0 There's no polling of a database. e2939887-10b8-4552-bf50-a15f8244e3fa-0 There's no spinning numbers. fc55ac30-b619-4f88-8895-4e926cf3ad77-0 Anyway, we'll go into that in a second, but what I just wanted fc55ac30-b619-4f88-8895-4e926cf3ad77-1 to make clear here is we have this overarching workflow, the fc55ac30-b619-4f88-8895-4e926cf3ad77-2 parent workflow or the dispatch workflow that starts number of fc55ac30-b619-4f88-8895-4e926cf3ad77-3 child processes. 31ecb956-3c1f-446a-8952-c7e9bebd15dc-0 And we're going to go into that in a second. d6396ef8-e9a1-4022-a3a2-70c1d34ee3b2-0 And I'm going to move over again back to code base. 72dd3db3-2f4f-432e-a0cf-45db98d032e0-0 If you just excuse me for a second. 73d2c331-fcf5-49a5-80d3-a94aeaf8505e-0 OK, I'm going to just close that up. ad14b694-2dbd-4512-9af9-6739f066e18c-0 OK. 55c05716-f08a-4709-8a4c-63aae15fc8a1-0 And now this solution looks very similar to. 21686f6f-cc5a-4587-8d53-68b33dac8210-0 Our Java native solution, and that's by design. d6069228-bef9-4ca2-baae-2accc04102ff-0 The whole purpose of Cadence is to enable developers to build d6069228-bef9-4ca2-baae-2accc04102ff-1 solutions almost exactly how they normally would, just with a d6069228-bef9-4ca2-baae-2accc04102ff-2 few helper functions that allow them to be more efficient. a3477846-b971-4973-b3dc-1024c6a262de-0 What you're looking at now is the connection string for our a3477846-b971-4973-b3dc-1024c6a262de-1 Cadence workers. 2bc08d04-534a-42bc-a778-5cbab159c2e1-0 You don't have to worry too much about the details here. 55c3d962-b180-4116-93f4-cc16d88f7c99-0 I just wanted to show you that it's very similar to the 55c3d962-b180-4116-93f4-cc16d88f7c99-1 connection code that we had for our Rabbit MQ. 15e5e231-5e30-4fc9-a1e8-307d56f53ed6-0 But we're only going to be doing it once in this particular 15e5e231-5e30-4fc9-a1e8-307d56f53ed6-1 instance and we don't have to look at it again. fee47a6b-9715-4222-9fbf-bac81f76b62c-0 So I'm just going to just scroll over here. 97fd8e4f-8721-4ca8-8589-7b64ece2d718-0 But all it does is it sets up a workflow client and a factory 97fd8e4f-8721-4ca8-8589-7b64ece2d718-1 with a couple of different services that it's running, and 97fd8e4f-8721-4ca8-8589-7b64ece2d718-2 then we're going to start doing the work. c8e9fa61-9c83-4118-b9c9-a1907598f2ce-0 Now, core, the core concept in Cadence is everything is an c8e9fa61-9c83-4118-b9c9-a1907598f2ce-1 interface. c387fad9-76d9-4d72-a52f-f4dae83a34f8-0 And this is a way that we allow our Cadence solutions to scale c387fad9-76d9-4d72-a52f-f4dae83a34f8-1 in a effective way and each workflow will implement this c387fad9-76d9-4d72-a52f-f4dae83a34f8-2 interface. ffd44371-d8ce-434a-9115-e400bae2c8c3-0 So just like we had in our native Java solution, we have an ffd44371-d8ce-434a-9115-e400bae2c8c3-1 entry point for the request. 06997ac3-94df-495d-8b76-ed2ef16bd2a5-0 And this is the service that's getting called when we place our 06997ac3-94df-495d-8b76-ed2ef16bd2a5-1 order on the queue. d96adbfd-cb48-43be-9f63-656d23228f67-0 And this is all happening inherently using Cadence d96adbfd-cb48-43be-9f63-656d23228f67-1 paradigms. f4742eff-dcb6-47b3-8146-5d5f3d0d418d-0 And again, you can see here, we still have the exact same if f4742eff-dcb6-47b3-8146-5d5f3d0d418d-1 statement, which could potentially turn into an if f4742eff-dcb6-47b3-8146-5d5f3d0d418d-2 statement. 0bc8b513-72b2-41e2-81dd-0f69acee4808-0 What actually happens is we are creating orders on a interface 0bc8b513-72b2-41e2-81dd-0f69acee4808-1 instead of adirect implementation. 3b0ce6fe-da9b-4764-8ce7-25e72cad10ae-0 And you can see here wefirst encountered already an 3b0ce6fe-da9b-4764-8ce7-25e72cad10ae-1 asynchronous procedure. 17a780be-0757-45bc-a989-cc6ce8eda98c-0 So what actually happens is when we're placing, we create a mega 17a780be-0757-45bc-a989-cc6ce8eda98c-1 burger order and we're adding it to a asynchronous workflow and 17a780be-0757-45bc-a989-cc6ce8eda98c-2 we're sending that off on an asynchronous QS, which 17a780be-0757-45bc-a989-cc6ce8eda98c-3 essentially means this code returns instantly and we'll skip 17a780be-0757-45bc-a989-cc6ce8eda98c-4 over theerror handling and immediately come to a new 17a780be-0757-45bc-a989-cc6ce8eda98c-5 command called workflow dot await. 81018387-e2d8-4d06-be53-f160e2002820-0 And that allows thatis a paradigm that is unique to 81018387-e2d8-4d06-be53-f160e2002820-1 Cadence. 2101ca91-4d0b-47e0-b73e-bccadc7dbdc5-0 And you can see in a number of different places we're calling 2101ca91-4d0b-47e0-b73e-bccadc7dbdc5-1 await. 57e49bec-b521-4de6-9654-1f5eaa66702a-0 And what this tells Cadence, the Cadence workflow is that we want 57e49bec-b521-4de6-9654-1f5eaa66702a-1 to actually block the thread for until a certain event happens. 3855be30-172f-45f9-a397-439369dc09b0-0 And in this case, we're checking if the ETA gets updated from its 3855be30-172f-45f9-a397-439369dc09b0-1 default of -1 or potentially the order gets rejected. c344e428-1a05-4fac-9b32-03b1a70f92eb-0 Now, if you remember, in the native solution, we actually had c344e428-1a05-4fac-9b32-03b1a70f92eb-1 to exit the original order and then start spinning on a on the c344e428-1a05-4fac-9b32-03b1a70f92eb-2 state machine to sort of check if the order has been updated by c344e428-1a05-4fac-9b32-03b1a70f92eb-3 doing third party polling. ad5ebd2c-5dfc-47b5-9904-6f0c5cf935cc-0 This can happen inherently within a cadence workflow. ecb8de94-62e1-41d2-93af-26d4c8cf5f32-0 All of this is self-contained. da176c94-bf9a-4a49-ab9a-7a1384114a5b-0 It's a single function that you can see here and this thread can da176c94-bf9a-4a49-ab9a-7a1384114a5b-1 block, but it's not. bd588207-a8ed-4390-bfdd-b1fc6e9ed79e-0 It will block the thread in this particular instance. 7b529cb3-5d95-4c79-b630-6aba3dc84795-0 But if this thread were aborted because it we needed the 7b529cb3-5d95-4c79-b630-6aba3dc84795-1 resources or for other reasons, it is re entrant and I'll show 7b529cb3-5d95-4c79-b630-6aba3dc84795-2 you how that actually works in a second. 75fb741c-2447-44f7-975c-5e93f5bb31ee-0 And because we're able to do this in a thread, Safeway and 75fb741c-2447-44f7-975c-5e93f5bb31ee-1 block, we can then immediately handle the scenario if a order 75fb741c-2447-44f7-975c-5e93f5bb31ee-2 gets rejected and informing the customer. 4ce440ac-2e29-468d-9ebf-8fd92bda360f-0 In this case, we're throwing a runtime exception because again, 4ce440ac-2e29-468d-9ebf-8fd92bda360f-1 Cadence handles the error handling inherently. 2e55da8e-fc74-47e8-9fa2-9b5b819c4a53-0 Once we're able move on to that state, we can then check if we 2e55da8e-fc74-47e8-9fa2-9b5b819c4a53-1 are not, if we're doing a delivery. 0025a701-7990-4fbe-a2e1-1d6f229dd601-0 And then again, we can call this a wait function. 5ca52e09-a874-4211-b75d-c6ae42495f30-0 Again, we could potentially be blocking, we could potentially 5ca52e09-a874-4211-b75d-c6ae42495f30-1 be dropping the queue and tile in and returning later and then 5ca52e09-a874-4211-b75d-c6ae42495f30-2 we can start another child workflow. f6831987-dc64-4f68-bd78-80889725d313-0 Now again, all of these paradigms are sort of built into f6831987-dc64-4f68-bd78-80889725d313-1 Cadence and this is how you would build your Cadence f6831987-dc64-4f68-bd78-80889725d313-2 application. 650916c8-f8e5-4ff2-b5b2-4594fc30bd4f-0 And I will remind you at this point that this particular 650916c8-f8e5-4ff2-b5b2-4594fc30bd4f-1 example, this Instafood cookbook that we're looking at now is 650916c8-f8e5-4ff2-b5b2-4594fc30bd4f-2 available on GitHub. da3d255b-bc1f-4712-86f6-d5a3b8f0f869-0 And then finally, what happens is we are able to complete our da3d255b-bc1f-4712-86f6-d5a3b8f0f869-1 Courier delivery and then complete our actual overall da3d255b-bc1f-4712-86f6-d5a3b8f0f869-2 order all in a single function. 8d4f2e41-81ed-477f-9704-0b672e0f7612-0 And you may be asking yourself, well, how is this, how can you 8d4f2e41-81ed-477f-9704-0b672e0f7612-1 handle, how can you recover from failure? dd626137-642a-4291-a3be-7220be4b8ac8-0 How does this actually, how is this any better than the native dd626137-642a-4291-a3be-7220be4b8ac8-1 Java solution? 33f70d87-290f-4ea6-bda1-22930ee0027e-0 And I will approach those subjects in a second. 9d4f09d3-dff9-4ce0-b279-00cb7814132d-0 I'll quickly move over. 9774974e-da95-4f56-b72c-ee4d890bfd98-0 I'm very conscious of the time here, so I just wanted to point 9774974e-da95-4f56-b72c-ee4d890bfd98-1 out a couple of things here in our Mega Burger Workflow worker. 870c2cc2-25fe-4bdb-8549-15aae2b770fd-0 I just wanted to call out specifically some of the 870c2cc2-25fe-4bdb-8549-15aae2b770fd-1 interface things that you have available to you when you're 870c2cc2-25fe-4bdb-8549-15aae2b770fd-2 working with Cadence. dade83dd-c292-489a-9659-1180d17b1eb7-0 So Cadence Workflow has a number of activities and you can dade83dd-c292-489a-9659-1180d17b1eb7-1 actually configure how these activities work and specifically dade83dd-c292-489a-9659-1180d17b1eb7-2 how we're going to retry specific scenarios here. b9436a9e-ea0c-4d2c-99ef-fe5a4ccf08f5-0 So you can see here that in the activity Builder, not only do we b9436a9e-ea0c-4d2c-99ef-fe5a4ccf08f5-1 show the interface of all the activities we're actually going b9436a9e-ea0c-4d2c-99ef-fe5a4ccf08f5-2 to be interacting with or calling, but you actually can b9436a9e-ea0c-4d2c-99ef-fe5a4ccf08f5-3 set a number of different settings and this can be changed b9436a9e-ea0c-4d2c-99ef-fe5a4ccf08f5-4 per activity if you want. 3c006a49-1399-4714-861b-11e07eeb37cc-0 And one of them is set retry options. f41aead0-5c4c-4d58-94a2-1aa5e11e9266-0 And that's really critically because in the Java application f41aead0-5c4c-4d58-94a2-1aa5e11e9266-1 I showed you, if we wanted to have the ability to retry f41aead0-5c4c-4d58-94a2-1aa5e11e9266-2 depending on a downstream API that we weren't familiar with or f41aead0-5c4c-4d58-94a2-1aa5e11e9266-3 that were potentially flaky, we would have to be building all f41aead0-5c4c-4d58-94a2-1aa5e11e9266-4 this logic ourself. f42469e9-ac15-4919-93e2-f4f3991e9f24-0 But Cadence expects anytime you're wrapping an activity that f42469e9-ac15-4919-93e2-f4f3991e9f24-1 this is a piece of work that could potentially fail or that f42469e9-ac15-4919-93e2-f4f3991e9f24-2 there may be we don't expect, we actually anticipate failure as f42469e9-ac15-4919-93e2-f4f3991e9f24-3 part of an activity. e69db556-5896-4d79-a828-ba5d2ec8571f-0 We don't expect always to work. a1f9da32-44ea-4256-a70e-60dba615bca8-0 And part of that is setting the retry options. 6422cd21-06f8-4392-bf2c-09a8f84fcee0-0 If I dive into here quickly, you can see here that retry options 6422cd21-06f8-4392-bf2c-09a8f84fcee0-1 are sort of very numerous. 221386b9-4109-4919-bdf6-08f553791c7d-0 And there's a bunch of different ways that we can configure the 221386b9-4109-4919-bdf6-08f553791c7d-1 retry functionality of Cadence activities, which is we can give 221386b9-4109-4919-bdf6-08f553791c7d-2 it a back off coefficient, a number of maximum attempts, 221386b9-4109-4919-bdf6-08f553791c7d-3 which is really helpful because you know, after maybe four or 221386b9-4109-4919-bdf6-08f553791c7d-4 five times you're like, OK, this error is actually probably gone 221386b9-4109-4919-bdf6-08f553791c7d-5 when these when you should expire the initial interval. 6004b9e7-97c7-4c05-ae23-1267810ab23f-0 You can see it's quite configurable. 853c2568-65f9-4e24-8b5d-220a645c0961-0 And specifically at the end here we have this do not retry, which 853c2568-65f9-4e24-8b5d-220a645c0961-1 is a set of errors that we tell Cadence. c3c268eb-0eb5-4cca-9e42-8c97904cd431-0 I want you to retry. a5d500dc-6b5e-4ec4-9a0d-e9d1d3672e0f-0 But if you hit this particular error, it's a fatal 1. 4bc44566-8cce-44db-9786-6cd4d6247692-0 And we should actually tell the customer that that's not going 4bc44566-8cce-44db-9786-6cd4d6247692-1 to work instead of retrying. 2ce4b7f7-a220-42c8-bee1-c09e5deac63d-0 And there are a number of defaults we can set, but you can 2ce4b7f7-a220-42c8-bee1-c09e5deac63d-1 see here we've set a retry interval of every 10 seconds. 36f4bb48-0a80-48b8-8292-73345054232f-0 It'll do a retry and it'll only try three times before we 36f4bb48-0a80-48b8-8292-73345054232f-1 determine that, yeah, maybe it'snot going to work. 465add43-eafa-49fb-8bb0-c917ebf5b63c-0 And another setting that's crucial to how Cadence works is 465add43-eafa-49fb-8bb0-c917ebf5b63c-1 we don't want these, we don't want every operation to run 465add43-eafa-49fb-8bb0-c917ebf5b63c-2 forever. 508ddd63-e858-4d80-8149-5ef0477bdc43-0 We do want to set limits on how long things can take. 7f154d03-ec0f-4aaf-8108-715bc908d835-0 And the schedule to close time out is kind of themain one 7f154d03-ec0f-4aaf-8108-715bc908d835-1 that we want to set and say, look, everything in this, all 7f154d03-ec0f-4aaf-8108-715bc908d835-2 these activities should finish within about 5 minutes. 2ec84742-d9a0-43de-95d6-7106c3995cb3-0 So if we're talking about polling the activity, polling 2ec84742-d9a0-43de-95d6-7106c3995cb3-1 the mega Burger API or potentially any,other API, 2ec84742-d9a0-43de-95d6-7106c3995cb3-2 this should take a maximum of 5 minutes. c4345e98-51d5-44e9-b995-0069a71d7359-0 And that's a pretty generous amount of time. 792d7d34-8ffe-443e-bc5f-d75e67c4beef-0 We probably generally pull that down depending on what operation 792d7d34-8ffe-443e-bc5f-d75e67c4beef-1 needs to take place. 3f01775b-0b0e-430f-8ce4-1694ed232578-0 And if we just quickly, I'm going to really quickly spin 3f01775b-0b0e-430f-8ce4-1694ed232578-1 through this is our ordering food inside our mega burger 3f01775b-0b0e-430f-8ce4-1694ed232578-2 workflow. eb1cab5b-ddb6-49a9-b40b-c3755cd2558d-0 And you can see here again, all of the logic that we want for eb1cab5b-ddb6-49a9-b40b-c3755cd2558d-1 this particular operation is in the single function. 414761aa-8c9f-469e-b84b-3cd6c479fb03-0 We don't have to offload the state and then poll it in a 414761aa-8c9f-469e-b84b-3cd6c479fb03-1 different activity. 81fe8ed5-d048-42fb-a7bb-2e01fec42c47-0 Everything you see here from start to finish is what will get 81fe8ed5-d048-42fb-a7bb-2e01fec42c47-1 executed to create an order. 561fa0d3-c2bb-4db6-8f1b-f21149c56c13-0 From start to finish you can see we create an order with our 561fa0d3-c2bb-4db6-8f1b-f21149c56c13-1 third party API which is on the activities and then we update 561fa0d3-c2bb-4db6-8f1b-f21149c56c13-2 the order status for our parent workflow. 33d24947-85f1-416e-85e9-9845a66d9d4a-0 So we're telling the parent workflow directly this is the 33d24947-85f1-416e-85e9-9845a66d9d4a-1 updated status and that then that can be given to the 33d24947-85f1-416e-85e9-9845a66d9d4a-2 customer. 17aa4254-be5a-439c-a410-d3c6d4f861c9-0 We then waiting for the order status to be accepted. 0e7f2a89-9dcf-4c99-a1ac-bd033f593b38-0 This also has a rejected handler because we can, when we have an 0e7f2a89-9dcf-4c99-a1ac-bd033f593b38-1 ETA, we then update directly to our parent workflow saying 0e7f2a89-9dcf-4c99-a1ac-bd033f593b38-2 here's the ETA. 84a4ddfd-63b4-447a-aba5-76c09e50be15-0 And what this how this actually works is it's on a signal 84a4ddfd-63b4-447a-aba5-76c09e50be15-1 method. 57253e26-1d07-49a8-9462-1bb58d925abc-0 So we can actually expose different methods on our parent 57253e26-1d07-49a8-9462-1bb58d925abc-1 and child workflows that tell Cadence that there are potential 57253e26-1d07-49a8-9462-1bb58d925abc-2 signals that'll be coming back and forth. a499b394-1639-42d4-b180-eaba9cf22d44-0 And the last thing I wanted to show here is how this updating a499b394-1639-42d4-b180-eaba9cf22d44-1 of orders works. a93daf38-f2b1-49f1-9b7a-793fcd314382-0 So what how it actually works is when we're polling in this a93daf38-f2b1-49f1-9b7a-793fcd314382-1 particular class here, when we're polling the status on our a93daf38-f2b1-49f1-9b7a-793fcd314382-2 third party API, what's really interesting to call out is this a93daf38-f2b1-49f1-9b7a-793fcd314382-3 workflow dot sleep concept. b6a595a3-fcdd-432c-97db-4af041a3daf5-0 So if you understand, we're running the workflow in a single b6a595a3-fcdd-432c-97db-4af041a3daf5-1 thread, but we don't what we want to do. 9648ceb9-8f7e-4639-bdab-d37c4299f748-0 We don't want to poll our mega burger API every second or every 9648ceb9-8f7e-4639-bdab-d37c4299f748-1 millisecond because we're going to get rate limited or it's just 9648ceb9-8f7e-4639-bdab-d37c4299f748-2 going to overload the downstream application. be0cd167-bd89-4787-b51d-b12a1cdcf49f-0 So we want to poll on a reasonable time frame, but we be0cd167-bd89-4787-b51d-b12a1cdcf49f-1 want to, we want to actually pause the thread while we're be0cd167-bd89-4787-b51d-b12a1cdcf49f-2 waiting for that time frame to expire. bb6c430d-0719-45b4-a2e8-c86c354048d6-0 Instead of doing a thread dot sleep, we're going to do a bb6c430d-0719-45b4-a2e8-c86c354048d6-1 workflow dot sleep. 34141ca1-baa1-4ce9-890e-cfa3decfd740-0 And what this actually does is it tells Cadence to actually, 34141ca1-baa1-4ce9-890e-cfa3decfd740-1 depending on the resource contention, what this actually 34141ca1-baa1-4ce9-890e-cfa3decfd740-2 might do is this might actually close down the thread in our 34141ca1-baa1-4ce9-890e-cfa3decfd740-3 workflow worker and release it for another workflow to start 34141ca1-baa1-4ce9-890e-cfa3decfd740-4 working. a29adc70-54dc-45b0-b771-8468980e4c92-0 And what'll actually happen is when this timer has actually a29adc70-54dc-45b0-b771-8468980e4c92-1 timer has persisted in Cadence and when the timer has expired, a29adc70-54dc-45b0-b771-8468980e4c92-2 Cadence will know to re wake this workflow and put it on the a29adc70-54dc-45b0-b771-8468980e4c92-3 queue and bring it back. 1cf152cb-cf05-4e26-a3dd-23b20949a802-0 And again, I'm going to show you just in a second how all of that 1cf152cb-cf05-4e26-a3dd-23b20949a802-1 actually recovers. 61ebd7a7-8c63-44c0-8e29-e6ee00423830-0 So these are thekind of things that you're getting out 61ebd7a7-8c63-44c0-8e29-e6ee00423830-1 of Cadence and a Cadence application. 235c3a59-a5a9-4852-81be-099991b1e8c4-0 You're getting the ability to store all of your business logic 235c3a59-a5a9-4852-81be-099991b1e8c4-1 in a single thread, the ability to sorry, a single function, the 235c3a59-a5a9-4852-81be-099991b1e8c4-2 ability to communicate between parent workflows and child 235c3a59-a5a9-4852-81be-099991b1e8c4-3 workflows. 75740ea2-94ce-45f1-9f28-b21a38d3a2f4-0 Inherently you don't have to build any logic to do that. 9d8c174a-9ece-4e1c-866a-4828f146f6e1-0 You just sort of build it into your interfaces and you're 9d8c174a-9ece-4e1c-866a-4828f146f6e1-1 getting the ability to prepare your resources correctly and 9d8c174a-9ece-4e1c-866a-4828f146f6e1-2 actually release and being as efficient as possible with your 9d8c174a-9ece-4e1c-866a-4828f146f6e1-3 workflow. 0cd1e199-87ad-4f3c-9aec-09bfed08cc84-0 Workflow workers you don't have to think about, you don't have 0cd1e199-87ad-4f3c-9aec-09bfed08cc84-1 to worry about thread contention or rehydrating of your data 0cd1e199-87ad-4f3c-9aec-09bfed08cc84-2 models. 53471505-2b6d-4ff0-93a3-c71c4a9205ab-0 So again, this is just going to be a high level introduction. 9bf2b87b-275d-4e1d-a780-9663637f8e4d-0 So I'm going to switch back to the slides now. 8f9bd682-61a5-4254-9d4f-c20797bf2997-0 I'm going to point out a few ways thatCadence is able 8f9bd682-61a5-4254-9d4f-c20797bf2997-1 to do this and then we'll be able to then sort of finish up 8f9bd682-61a5-4254-9d4f-c20797bf2997-2 the slides. fb447f80-b55e-4953-9d1f-76df88ac35b0-0 So I guess the first question you may be having is sort of how fb447f80-b55e-4953-9d1f-76df88ac35b0-1 does a Cadence request stream work? ac3f96eb-46c9-4c83-b0ef-643b5be1cd52-0 And this is sort of at a high level, but we saw earlier that ac3f96eb-46c9-4c83-b0ef-643b5be1cd52-1 when we started the workflow, it gets sent to our Cadence server. 94bdf2cf-add6-4fa8-b387-c795eb6bdf1a-0 And what Cadence is doing in the back end is essentially every 94bdf2cf-add6-4fa8-b387-c795eb6bdf1a-1 step that gets executed. 24648b5d-b58f-4dcf-8b7a-d447f48336c7-0 Anything that says workflow dot or if an activity gets called, 24648b5d-b58f-4dcf-8b7a-d447f48336c7-1 the result of that activity or command is actually persisted in 24648b5d-b58f-4dcf-8b7a-d447f48336c7-2 the persistence layer. 0bfc94ab-d056-4251-a778-dbbbed179ce7-0 And it doesn't matter if it's Cassandra or Postgres or 0bfc94ab-d056-4251-a778-dbbbed179ce7-1 whatever. ca7e47b3-cb89-4be5-a630-7be733576706-0 What happens is it then internally will place a request ca7e47b3-cb89-4be5-a630-7be733576706-1 on a queue and we have a set of workflow workers or ca7e47b3-cb89-4be5-a630-7be733576706-2 activity workers that listen to particular queues. 10764520-fe03-455b-9648-c368cd68a6bb-0 So if I'm a workflow worker for Mega Burger, then I'm listening 10764520-fe03-455b-9648-c368cd68a6bb-1 on the mega burger queue and once the work is available, it's 10764520-fe03-455b-9648-c368cd68a6bb-2 a made available to me and I start working on it. a9edb998-065b-475c-b500-ad2da8ba8f4b-0 Eventually what will happen is I get told to start working on it. 26c55757-6c9b-4998-8026-b7e86ff7a18e-0 Eventually throughout the workflow logic that we'll be 26c55757-6c9b-4998-8026-b7e86ff7a18e-1 calling an activity and this again, this activity we placed 26c55757-6c9b-4998-8026-b7e86ff7a18e-2 on adifferent queue. f5578de9-1d59-4d9b-8fd1-62d96254be13-0 And these workflow, these activity workers can sit f5578de9-1d59-4d9b-8fd1-62d96254be13-1 separately or they can be the same worker and they sit, listen f5578de9-1d59-4d9b-8fd1-62d96254be13-2 to a different queue and they start again to return an f5578de9-1d59-4d9b-8fd1-62d96254be13-3 activity. f04b3ee3-68f5-4034-b1ab-a5f64c9048bc-0 They do the work, they return a result, that result gets f04b3ee3-68f5-4034-b1ab-a5f64c9048bc-1 persisted in our database and then the process workflow can f04b3ee3-68f5-4034-b1ab-a5f64c9048bc-2 continue. ecccb583-08bb-4059-97e0-d985a81f1411-0 So that explains sort of how we're able to effectively ecccb583-08bb-4059-97e0-d985a81f1411-1 offload the responsibility of persisting state and the result ecccb583-08bb-4059-97e0-d985a81f1411-2 of our activities on our Cadence server. bdde9d4c-6072-4ba8-8183-54af8ec1b6ae-0 And that's sort of how it works internally. f210fdfa-5b06-4521-b14d-b45c74d25b9f-0 You don't actually have to know how this works necessarily in f210fdfa-5b06-4521-b14d-b45c74d25b9f-1 Cadence, but it's just helpful for you to understand the basic f210fdfa-5b06-4521-b14d-b45c74d25b9f-2 flow of how a workflow works. fb1cffa5-5487-4150-bd6a-f36d9f123d0e-0 But what about failure recovery? dbcf7cf2-a74b-4875-86ff-2df1ccd5b9a4-0 So I'm going to take just a brief high level view of, it's dbcf7cf2-a74b-4875-86ff-2df1ccd5b9a4-1 not going to be specific to our example here. 39c04d2d-e610-4be8-832b-daaedfb903f3-0 But you saw in our previous mega Burger example that there were a 39c04d2d-e610-4be8-832b-daaedfb903f3-1 number of different steps involved in the workflow. 03d5fd3f-a007-4a51-958d-25a158bd03bb-0 We needed to create the workflow, sorry, we need to 03d5fd3f-a007-4a51-958d-25a158bd03bb-1 create the order in a Mega Burger API. c3196d09-b4c3-4f59-8f7b-0f6b8e247b07-0 And then we were doing a number of different instances of c3196d09-b4c3-4f59-8f7b-0f6b8e247b07-1 polling that task and then updating the state and then c3196d09-b4c3-4f59-8f7b-0f6b8e247b07-2 moving on to the next state. 34d7d03a-19c0-429d-8965-fda651c732c5-0 So how,might that actually work? 1854affe-f06e-47ad-952e-9a3903b764c9-0 So in Cadence, an activity or a task is what we encapsulate when 1854affe-f06e-47ad-952e-9a3903b764c9-1 we're, it's a long, expensive piece of work. ace63304-c1d5-4fdb-aec6-417dd39260eb-0 If you can imagine, we're going out to a cloud service, we're ace63304-c1d5-4fdb-aec6-417dd39260eb-1 downloading a big file or something that is just long and ace63304-c1d5-4fdb-aec6-417dd39260eb-2 expensive. 99aa3db8-c626-44e5-b6e6-20adfaab5b1e-0 We encapsulate that in a task. 2e2a5665-3920-4350-9273-d628c8f8946b-0 So we do the work, we get a result, and then it's sent back 2e2a5665-3920-4350-9273-d628c8f8946b-1 to our Cadence server and then our workflow worker can move on 2e2a5665-3920-4350-9273-d628c8f8946b-2 to the next task and again that same process repeats. e960aa18-6a20-4ea0-8fb9-56998f0108e4-0 But then what happens when we execute task 3 and we get an e960aa18-6a20-4ea0-8fb9-56998f0108e4-1 exception we're not expecting? 6ec72b51-16c8-460e-a038-b6efa0050974-0 Maybe the downstream API hasmade our has give us unhandled 6ec72b51-16c8-460e-a038-b6efa0050974-1 exception that we weren't expecting. d605f8d2-2bfb-4cf3-8780-6fef1a20241a-0 Maybe our service has restarted because of OS upgrades or maybe d605f8d2-2bfb-4cf3-8780-6fef1a20241a-1 someone has done a release and it's made the workflow workers d605f8d2-2bfb-4cf3-8780-6fef1a20241a-2 restart or potentially maybe we just run out of memory on these d605f8d2-2bfb-4cf3-8780-6fef1a20241a-3 things and our workflow worker has crashed. a5fc385d-7c40-4512-8f44-431e217fa8af-0 So what actually happens? 62b982e1-1f9a-4ed1-adff-a7ec05e57c14-0 How does Cadence actually help us? 9a8504c5-ea33-4854-8c52-e1d09b77c8ec-0 Because you can see in my previous in my code examples, 9a8504c5-ea33-4854-8c52-e1d09b77c8ec-1 there was no mechanism for doing a retry. 68a229c6-b87f-4d2d-8bab-10a4fc8bb150-0 Well, what actually happens is Cadence knows that we haven't 68a229c6-b87f-4d2d-8bab-10a4fc8bb150-1 finished our task. d0736af3-575b-45d1-9b5f-4a1359e83cc4-0 So what happens is a workflow will be after a certain period d0736af3-575b-45d1-9b5f-4a1359e83cc4-1 of time, the workflow will be understood to have not been d0736af3-575b-45d1-9b5f-4a1359e83cc4-2 completed and the work will be sent to a separate a new d0736af3-575b-45d1-9b5f-4a1359e83cc4-3 workflow worker. d74d3cfa-c247-44e7-a836-92d87de65115-0 And the workflow worker will come online and say OK I'm going d74d3cfa-c247-44e7-a836-92d87de65115-1 to be building doing this workflow, what do I need to do? 820d53ba-2fa2-4bec-9da8-af0a4d9275c6-0 And it reads down, it follows, it executes the code in the 820d53ba-2fa2-4bec-9da8-af0a4d9275c6-1 workflow until it reads, comes to the first task. 12eaf808-1a8d-42a4-ae2e-549d4a2bc3d9-0 And what it first does is instead of doing the work to the 12eaf808-1a8d-42a4-ae2e-549d4a2bc3d9-1 cloud, it says, well, do we have a result in our history already 12eaf808-1a8d-42a4-ae2e-549d4a2bc3d9-2 for this having been done? 213211b6-2b9e-48f4-9709-178305ce42f0-0 And we do. 3a0b20b9-9b2e-40b2-ab36-f7cff2fa361c-0 So we skip over the expensive call to a third party API, 3a0b20b9-9b2e-40b2-ab36-f7cff2fa361c-1 something we don't necessarily want to repeat. 683a0faf-d242-4505-a323-4df45aeaa16d-0 And we get the results straight out of the history. 538952cf-6c76-4a25-b7ce-feaa6f6f54ab-0 And in task 2, the same thing happens. 18678884-cc1e-407e-80bd-be57967d51c2-0 We go, well, we've got a result in task 2, let's just get it 18678884-cc1e-407e-80bd-be57967d51c2-1 straight out of cadence. 21734a60-6fcb-4048-a7a5-6317d4f12052-0 And we continue straight to Task 3, and then we can then make 21734a60-6fcb-4048-a7a5-6317d4f12052-1 that expensive call again and persist it in our Cadence 21734a60-6fcb-4048-a7a5-6317d4f12052-2 application and the process repeats. 9ff96682-be24-4dfa-b4dd-e8701c247e72-0 And all of that functionality that you see in the workflow 9ff96682-be24-4dfa-b4dd-e8701c247e72-1 code and in this example diagram I've got here that is native to 9ff96682-be24-4dfa-b4dd-e8701c247e72-2 Cadence, you don't have to do anything special. 8aefd783-d9e5-4b23-969f-b48c1ca96794-0 You just have to use activities and encapsulate them correctly. fa3eef3b-519c-4b76-aebe-0e48ae28cdda-0 And Cadence will be able to recover these things by default fa3eef3b-519c-4b76-aebe-0e48ae28cdda-1 without you having to do any extra work. b1cac3f2-de4e-49eb-9531-8dbeacf009ab-0 And that is a massive, huge efficiency gain that you can b1cac3f2-de4e-49eb-9531-8dbeacf009ab-1 take when you're using Cadence because you can see that we're b1cac3f2-de4e-49eb-9531-8dbeacf009ab-2 not worrying about persisting the state, We're not worrying b1cac3f2-de4e-49eb-9531-8dbeacf009ab-3 about updating how things have been running. 6f2cc1bb-642f-4e90-bd84-0a9cb3faf123-0 We're not running third party services. f3e6fc4a-01f3-48a6-8375-48277aad4a29-0 The same service that you run to actually process the workflow is f3e6fc4a-01f3-48a6-8375-48277aad4a29-1 also going to be held responsible for rehydrating a f3e6fc4a-01f3-48a6-8375-48277aad4a29-2 failed a worker and then getting on with the task and not f3e6fc4a-01f3-48a6-8375-48277aad4a29-3 repeating expensive third party API calls that you don't want to f3e6fc4a-01f3-48a6-8375-48277aad4a29-4 waste time and resources doing, right? f0bdb4ee-2b08-403d-af63-d6cd1d754c1d-0 We kind of had a whirlwind tour of some code, both native code f0bdb4ee-2b08-403d-af63-d6cd1d754c1d-1 and cadence code. a5856376-7d95-45c7-a024-51ae82b2c4c1-0 I hope it was at least followable at least to a little a5856376-7d95-45c7-a024-51ae82b2c4c1-1 bit. eee050c2-9707-48f3-aeed-d5306ae62b34-0 But what is the overall summary that we can take from these eee050c2-9707-48f3-aeed-d5306ae62b34-1 examples? cc868625-ea5a-437f-95e6-9aff3ed0f093-0 Again, these are toy programs, but they do represent real world cc868625-ea5a-437f-95e6-9aff3ed0f093-1 scenarios. 34732c39-3d22-4251-99e6-9c6d902c079b-0 And hopefully some of those examples that I showed you are 34732c39-3d22-4251-99e6-9c6d902c079b-1 things that you are encountering on your day-to-day life as an 34732c39-3d22-4251-99e6-9c6d902c079b-2 engineer or as a project manager and you need solutions for. 0c866f85-1ee0-4e07-811e-19adf8ee4263-0 And So what are we, how we actually are we able to quantify 0c866f85-1ee0-4e07-811e-19adf8ee4263-1 how much benefit we're able to take from Cadence? 0d84503c-6a7d-4d77-b9be-8233fa9389d6-0 Well, the cheat answer is it depends. ac8c8ac6-5ffa-4fad-aa32-ba64e2b5b084-0 And that is going to be the case, I'm afraid, depending on ac8c8ac6-5ffa-4fad-aa32-ba64e2b5b084-1 how your company is set up and how your engineering team ac8c8ac6-5ffa-4fad-aa32-ba64e2b5b084-2 functions. 4d218eb1-fc13-4956-b962-84fe4e0298a4-0 But what can we actuallylook at andpoint 4d218eb1-fc13-4956-b962-84fe4e0298a4-1 at and say these are definite things that you gain efficiency 4d218eb1-fc13-4956-b962-84fe4e0298a4-2 on, even if it's not fully quantifiable? 9e28008f-bdf1-4302-aee9-61217d9685c8-0 Well, for a single workflow project, let's just say you're 9e28008f-bdf1-4302-aee9-61217d9685c8-1 new to Cadence. 2fa03012-564d-4614-bfd9-5e33a3432e28-0 You've got a state machine that you want to manage in a 2fa03012-564d-4614-bfd9-5e33a3432e28-1 distributed way. c0c37dfd-dce4-4b36-92d3-68567c3faeaf-0 Well, first of all, you don't have to write your own retry c0c37dfd-dce4-4b36-92d3-68567c3faeaf-1 logic. ecf89e21-1083-42b7-92ac-98afde4dc2ad-0 Now you may be already taking the advantage of third party ecf89e21-1083-42b7-92ac-98afde4dc2ad-1 libraries to do that for you, depending on, you know, whether ecf89e21-1083-42b7-92ac-98afde4dc2ad-2 it's an AWS call or AGCP call or some other third party API. db496465-0c6d-4f56-af44-2dd377576773-0 But all of that logic is inherent to a Cadence db496465-0c6d-4f56-af44-2dd377576773-1 application. a5c58121-6b0d-46cd-bd37-d07af45e293f-0 You don't have to write it. c73ac947-b2d3-41a4-a422-abcefc423fa2-0 You just have to use the helper functions that are available in c73ac947-b2d3-41a4-a422-abcefc423fa2-1 the Cadence API. 9c4f649d-8280-45e4-b3c5-75ca39245bb6-0 So that's a really big benefit of things you don't have to 9c4f649d-8280-45e4-b3c5-75ca39245bb6-1 worry about. 79983b39-fa96-453a-92dc-f7f608d8e2e0-0 You don't have to worry about scalability because what I'll do 79983b39-fa96-453a-92dc-f7f608d8e2e0-1 is I'll quickly scroll up to show you how cadence scaling 79983b39-fa96-453a-92dc-f7f608d8e2e0-2 works. f23b2f28-0045-42f5-8dad-8fcc1720842c-0 So you can see here the activity workers, because they're f23b2f28-0045-42f5-8dad-8fcc1720842c-1 stateless machines that subscribe to a particular queue, f23b2f28-0045-42f5-8dad-8fcc1720842c-2 we can have workflow works and activity workers scale f23b2f28-0045-42f5-8dad-8fcc1720842c-3 automatically. c162e240-ed4a-4626-9ddf-c56b70de9147-0 So you can have, because they just sit there andwait on a c162e240-ed4a-4626-9ddf-c56b70de9147-1 queue because they don't have to worry about the state c162e240-ed4a-4626-9ddf-c56b70de9147-2 themselves. 2ab60d98-c7c8-43d7-875e-570e9c7a374c-0 You can have one to a million of these things depending on where 2ab60d98-c7c8-43d7-875e-570e9c7a374c-1 your scalable needs are. ee0e8c12-aa28-45d4-a9b0-04b291d61cb8-0 So the scalability of Cadence, you can start really small, have ee0e8c12-aa28-45d4-a9b0-04b291d61cb8-1 a single worker for each of these things and you can ee0e8c12-aa28-45d4-a9b0-04b291d61cb8-2 actually tailor your scalability to your requirements. ffaa6b23-11dc-4531-851c-75eb93bbf23a-0 And because they're stateless machines and they don't have to ffaa6b23-11dc-4531-851c-75eb93bbf23a-1 worry about connecting to state or to a database or whatever, ffaa6b23-11dc-4531-851c-75eb93bbf23a-2 that scalability comes for free. 5dd33bdc-1144-49aa-a01e-a24ca37c6c0e-0 The fault tolerant, I just showed you how Cadence is able 5dd33bdc-1144-49aa-a01e-a24ca37c6c0e-1 to recover from failures and that, again, it's inherent. 58134a76-c4e5-4367-a7fb-5e5034fae028-0 So not only is it fault tolerant, as an engineer, as 58134a76-c4e5-4367-a7fb-5e5034fae028-1 someone who's building this logic, you don't have to worry 58134a76-c4e5-4367-a7fb-5e5034fae028-2 about it. cfe3ddf5-fd19-4f59-8975-bdeb01c1fe41-0 You don't have to. c2dd34ca-8ad0-400a-b8b2-1ffac2ff8bc2-0 There are some rules you have to follow, but you don't actually c2dd34ca-8ad0-400a-b8b2-1ffac2ff8bc2-1 have to build the mechanism to recover from this failure state. fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-0 And you don't have to worry about state persistence, which fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-1 removes quite a bit of, depending on your fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-2 infrastructure, it could be boilerplate code or could be fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-3 quite a lengthy code base, which is to set up a database fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-4 connection and to manage our data models and potentially you fec3e3e1-fcb5-4471-9ffd-6f8b5e8d072f-5 have an ORM that's doing the management layer for you. b31224b8-9316-404b-80ae-2d2a5c94b5af-0 All of that is gone. 33634b19-3fff-42d4-a8e2-7f31a7775f29-0 With Cadence, you don't have to worry about it. ec3cd558-6611-4360-a07b-b406ad233812-0 It's all handled by the Cadence application. 13f8d8b3-5b36-4afd-a973-56eed5a765d1-0 So if we take a step back and just think about that's why 13f8d8b3-5b36-4afd-a973-56eed5a765d1-1 Cadence was written because Uber. 032ac295-751f-4db2-86ea-8184da5268ea-0 Recognise that people were building state machines and 032ac295-751f-4db2-86ea-8184da5268ea-1 workflow management systems and doing a lot of similar things 032ac295-751f-4db2-86ea-8184da5268ea-2 and a lot of things in sub optimal ways. 1f52c214-03ad-4965-834c-019998b5daee-0 And what they've done is they've packaged those common solutions 1f52c214-03ad-4965-834c-019998b5daee-1 and best practices and put it in a third party application that 1f52c214-03ad-4965-834c-019998b5daee-2 you can subscribe to essentially. 9056e113-e610-4551-8e70-4f5d0d028d48-0 And if we take a even a further step back broadly, if you use 9056e113-e610-4551-8e70-4f5d0d028d48-1 Cadence as your solution for distributor workflows and9056e113-e610-4551-8e70-4f5d0d028d48-2 code management, as time progresses, you'll actually 9056e113-e610-4551-8e70-4f5d0d028d48-3 start to be able to easily uncover efficiency gains 9056e113-e610-4551-8e70-4f5d0d028d48-4 specifically around things like common functionality. 916014d2-7a52-4afb-bec6-5c572e4f9a47-0 So you can imagine in any workplace, you're building logic 916014d2-7a52-4afb-bec6-5c572e4f9a47-1 to run reports or do particular tasks that are a very common 916014d2-7a52-4afb-bec6-5c572e4f9a47-2 across no matter what functionality you'rein 916014d2-7a52-4afb-bec6-5c572e4f9a47-3 when they are already exposed as activities, when they're 916014d2-7a52-4afb-bec6-5c572e4f9a47-4 already, when you're already expected to build an interface 916014d2-7a52-4afb-bec6-5c572e4f9a47-5 and an implementation and then a separate worker to offload that 916014d2-7a52-4afb-bec6-5c572e4f9a47-6 functionality, it becomes really obvious and easy for you to then 916014d2-7a52-4afb-bec6-5c572e4f9a47-7 take that functionality and make it available to anyone who needs 916014d2-7a52-4afb-bec6-5c572e4f9a47-8 it. 3b1a6b73-6d48-432a-982d-5c5d54ec0669-0 So for example, if you've written a particularly effective 3b1a6b73-6d48-432a-982d-5c5d54ec0669-1 way to generate reports or perform Etls at a certain level, 3b1a6b73-6d48-432a-982d-5c5d54ec0669-2 that functionality is really easy to offload to other 3b1a6b73-6d48-432a-982d-5c5d54ec0669-3 developers and functional areas that are using Cadence, they can 3b1a6b73-6d48-432a-982d-5c5d54ec0669-4 sort of start picking stuff off as you would off a shelf 3b1a6b73-6d48-432a-982d-5c5d54ec0669-5 essentially. 101618c2-ed8c-4612-8d07-a7e9fe80c229-0 So you start building this library of activities and 101618c2-ed8c-4612-8d07-a7e9fe80c229-1 solutions that become really shareable because you're all 101618c2-ed8c-4612-8d07-a7e9fe80c229-2 using a common approach. 1c27ed16-0d70-4f3b-852e-76c57b157d9d-0 And it doesn't have to be the same language because Cadence is 1c27ed16-0d70-4f3b-852e-76c57b157d9d-1 is language agnostic. 457d8018-ecd2-4645-86cb-c25c4bf11af1-0 But what you can have is a library and start building up 457d8018-ecd2-4645-86cb-c25c4bf11af1-1 these things. dd457740-d558-4a26-af43-dbcef7a0a871-0 And that is a massive efficiency again and again because you dd457740-d558-4a26-af43-dbcef7a0a871-1 start lessening the double handling that's happening across dd457740-d558-4a26-af43-dbcef7a0a871-2 the across the company. c6cebd4e-a628-4a6d-aef9-54688c7a0a6a-0 The final thing that is really beneficial for a company is if c6cebd4e-a628-4a6d-aef9-54688c7a0a6a-1 you have this consistent infrastructure. 4d03aea4-1695-41c1-b736-3d77c212cabc-0 Again, Cadence doesn't demand you build things in Java or even 4d03aea4-1695-41c1-b736-3d77c212cabc-1 only Go. b8883b69-3ef3-407c-90ff-fe6180e18fa1-0 There are ways to use Cadence by using a REST API or other b8883b69-3ef3-407c-90ff-fe6180e18fa1-1 mechanisms that allow you to write Cadence workflows in kind b8883b69-3ef3-407c-90ff-fe6180e18fa1-2 of any language. df30382e-b33e-44ca-b10a-10bd61becf7d-0 But what it does mean is that as an engineer, it's more easy for df30382e-b33e-44ca-b10a-10bd61becf7d-1 your company to then talk about how you're going to be df30382e-b33e-44ca-b10a-10bd61becf7d-2 developing solutions if it's all within the same infrastructure, df30382e-b33e-44ca-b10a-10bd61becf7d-3 in the same paradigms. bbd048e6-5ef8-4b13-9c96-8ed747bb9a6d-0 It makes cross functional teamwork much more effective. 4535526a-abf3-4e1d-968f-597efe86d752-0 It allows you to communicate easily and then have the same 4535526a-abf3-4e1d-968f-597efe86d752-1 sort of understanding of what is capable within a company. 0a2ce9c7-6848-40a0-a60c-37ff4bdd680f-0 So hopefully you can see as these things scale out, the 0a2ce9c7-6848-40a0-a60c-37ff4bdd680f-1 efficiency gains actually become more and more as,time 0a2ce9c7-6848-40a0-a60c-37ff4bdd680f-2 progresses. 9c4a0386-f119-44be-bb70-fcc0a8340b26-0 And again, because we have this singular solution that's9c4a0386-f119-44be-bb70-fcc0a8340b26-1 working across the company and I've done a,very lot of 9c4a0386-f119-44be-bb70-fcc0a8340b26-2 talking. 8e36ecde-6931-46cb-9803-16488a8c91bf-0 Sorry for going a little bit over what we said, but I will 8e36ecde-6931-46cb-9803-16488a8c91bf-1 pause here and just check if we have any questions from our 8e36ecde-6931-46cb-9803-16488a8c91bf-2 audience. e95dfad0-d011-4208-87f0-e40fcd5281b3-0 Otherwise we can then finish up. 215352f6-699f-4aec-9491-8f5de22450e2-0 Awesome. 4622412f-085a-422e-883e-bcedc783eef8-0 Thanks John for that group presentation. c95e7473-a5ab-40f7-8a37-c8cd301a99a4-0 So yeah, so now we're going to jump to the Q&A section of c95e7473-a5ab-40f7-8a37-c8cd301a99a4-1 the webinar. 3857d544-0cd9-4c6a-9183-a38b70ba50ce-0 So please feel free to drop any of your questions into the right 3857d544-0cd9-4c6a-9183-a38b70ba50ce-1 hand side of your screen. 73835916-a20a-445c-8403-55aa24b944b2-0 One we did get a lot was will this be available on demand 73835916-a20a-445c-8403-55aa24b944b2-1 after and yes, we will send out the reporting after the session 73835916-a20a-445c-8403-55aa24b944b2-2 concludes. 12745e02-e3f2-4e92-9f11-d1173cfb2e48-0 So let's see here. 4cb443a0-608f-48cc-8f6a-1904ce083a7a-0 One of the questions we got was I saw that Cadence uses 4cb443a0-608f-48cc-8f6a-1904ce083a7a-1 Cassandra to store data. 20fc306a-8d6f-4710-84f9-fbc1c60643e5-0 Does that support any other databases? 266f5669-284a-4a19-85c6-1d272b81c5e2-0 Yep. 56a41ea3-0347-4fcb-9f12-9bd37612f742-0 So you saw I actually made it a call out in the previous 56a41ea3-0347-4fcb-9f12-9bd37612f742-1 example, but yeah, we actually do a Cadence supports a number 56a41ea3-0347-4fcb-9f12-9bd37612f742-2 of different back ends. 084b9ddf-c5eb-4940-864c-9fba3010d85c-0 So Insta cluster uses Cassandra because we are Cassandra 084b9ddf-c5eb-4940-864c-9fba3010d85c-1 experts, but Cadence also supports Postgres, which we have 084b9ddf-c5eb-4940-864c-9fba3010d85c-2 an Insta Cluster solution for as well. 9a29e7df-171a-413a-8752-34c33807784f-0 But there's also MySQL and Asila database. 4ee80700-a9aa-4c5b-b1b8-582e01cea8b5-0 So the intention is theback end service, the persistence 4ee80700-a9aa-4c5b-b1b8-582e01cea8b5-1 layer is pluggable in cadence. 5dcaf726-3d21-4a61-818b-d0e06ae9437d-0 So even if you wanted to contribute to cadence, you could 5dcaf726-3d21-4a61-818b-d0e06ae9437d-1 potentially be, you could introduce your own back end 5dcaf726-3d21-4a61-818b-d0e06ae9437d-2 service that you are familiar with or you want to manage 5dcaf726-3d21-4a61-818b-d0e06ae9437d-3 yourself. 8d51d2eb-cbbd-40c5-9357-f08c83423ac2-0 It's a fully pluggable back end service. 592c554a-d65c-44d9-966c-79aba12ee9b1-0 So yeah, it's basically anything you want. b40d5746-5f77-4b25-9e06-0fdba739aa8c-0 But at the moment themain ones are Cassandra, Postgres, My b40d5746-5f77-4b25-9e06-0fdba739aa8c-1 sequel and Silla. 4baa6cc5-8a6b-4b7e-8c79-37df5b53f788-0 Awesome. d7fb6406-15ac-42e8-a445-fa041de5cb65-0 Thanks, John, another question we had come through was what d7fb6406-15ac-42e8-a445-fa041de5cb65-1 kind of metrics does Cadence expose? 28ecc71e-2337-4844-83b7-6dcfeea0e4ba-0 That's a good question. 017a8c76-7a39-4366-94f0-f28a4cac54e4-0 So I didn't actually go into sort of the operational side of 017a8c76-7a39-4366-94f0-f28a4cac54e4-1 Cadence. fe1e40fa-8f75-448a-83ca-dd0880730042-0 We can probably do that in another form. 33ce666a-3891-4d58-abf0-0518b4d6c538-0 But just in a nutshell, Cadence actually exposes a number of 33ce666a-3891-4d58-abf0-0518b4d6c538-1 different Prometheus endpoints, which makes it really easy for 33ce666a-3891-4d58-abf0-0518b4d6c538-2 you to plug in a Prometheus instance and,pull the 33ce666a-3891-4d58-abf0-0518b4d6c538-3 metrics out. 49dc0646-75c5-49c5-a756-673914ff3126-0 We actually had, there's a demo in there, Docker compose file 49dc0646-75c5-49c5-a756-673914ff3126-1 that will set up a Prometheus server and allow you topull 49dc0646-75c5-49c5-a756-673914ff3126-2 the metrics directly out of the Cadence applications. 9f80edf3-bbb0-40c5-8604-839b72a38648-0 The various, and they're split by the different roles that a 9f80edf3-bbb0-40c5-8604-839b72a38648-1 Cadence server can actually run. e1dcef32-a343-46a6-8ac2-bfe116f0f113-0 And they're all exposed on a Prometheus port. 22245128-ca20-41ca-b74c-68c8190ba3c9-0 And you can just pull them straight in and,start 22245128-ca20-41ca-b74c-68c8190ba3c9-1 working with them that way. a1b2d88b-ff7e-474c-a8da-5f5b331a1c1a-0 Yeah, that's a great question. 9cd51a69-dc53-4be4-94d5-755c0ad7e1be-0 And yeah, you can see that on the Cadence GitHub. 834fccde-60a4-40b5-9bcb-68be3a5699dd-0 So we can talk about that in another way sometime. 51064388-98d1-4daf-ac12-55eedc7f3966-0 Awesome, thanks. e2aef5e1-7aa8-4e6a-8228-aa8357af2daf-0 So we have time for about one more question then we're going e2aef5e1-7aa8-4e6a-8228-aa8357af2daf-1 to have to wrap up. 3a0a690e-a27c-47eb-8858-0744ab787a9f-0 Let's see here. ce24643e-abf2-45f0-b0c6-58676cab1fd9-0 If we have a workflow that we need to make a change to, how ce24643e-abf2-45f0-b0c6-58676cab1fd9-1 does Cadence support updating workflows that are already ce24643e-abf2-45f0-b0c6-58676cab1fd9-2 running? ec3bb081-122a-4a97-bccb-f9ce8a51c3b4-0 Yeah, so that is another great question. 5902414e-c42e-4af8-8595-7401d7448612-0 Actually it's actually handled in, I think I may have mentioned 5902414e-c42e-4af8-8595-7401d7448612-1 it, one of the cookbooks that we have. e4bd78b9-13bb-42a4-a690-f3153b8d5267-0 I'll quickly switch back to the code base just to give you a e4bd78b9-13bb-42a4-a690-f3153b8d5267-1 taste of what it looks like. 65fc5132-94af-4ba8-83f2-1f49193e37d0-0 And specifically in the Courier service we have this ability to 65fc5132-94af-4ba8-83f2-1f49193e37d0-1 check workflow versions. f3559188-cc88-42c7-8133-b4fca56c877f-0 So there is the concept of versioning inCadence. f776fa0a-10f1-4ad6-9ca9-cca704593b29-0 And what it actually does is it creates a branching path that f776fa0a-10f1-4ad6-9ca9-cca704593b29-1 allows you to say to introduce new functionality to an existing f776fa0a-10f1-4ad6-9ca9-cca704593b29-2 in flight workflow. 94456220-db13-49e4-acd7-29d242933bcf-0 But if at the time that workflow was generated it didn't expect 94456220-db13-49e4-acd7-29d242933bcf-1 that functionality to exist, it will skip over. e3e2284a-aede-4cbc-adae-22a7281234b2-0 So it essentially allows you to have branching paths in your e3e2284a-aede-4cbc-adae-22a7281234b2-1 existing workflow to introduce new functionality without e3e2284a-aede-4cbc-adae-22a7281234b2-2 affecting the existing functioning workflows, which is e3e2284a-aede-4cbc-adae-22a7281234b2-3 a really good way and reduces the risk of introducing, e3e2284a-aede-4cbc-adae-22a7281234b2-4 introducing new functionality. 17fc61d0-1369-4309-8b9f-8011796a4573-0 And it allows you to update in flight jobs without affecting 17fc61d0-1369-4309-8b9f-8011796a4573-1 their potential outcome. d300b2f7-7984-4b13-8c46-ac24ca27f718-0 So again, that is handled in the Insta, in Insta cluster d300b2f7-7984-4b13-8c46-ac24ca27f718-1 cookbooks we have for caters, there's a specific cookbook d300b2f7-7984-4b13-8c46-ac24ca27f718-2 dedicated to understanding how our how the versioning works. 34cd364f-c10e-4242-b4d0-8d2dacdc1125-0 But yes, absolutely it,supports versioning. 0f56c369-1ca6-412c-aaaa-cfdb0b3ade09-0 It's a little bit complicated, but if you read through the 0f56c369-1ca6-412c-aaaa-cfdb0b3ade09-1 cookbook or we can have other documentation as well online of 0f56c369-1ca6-412c-aaaa-cfdb0b3ade09-2 how to do it. fe8b1214-50f6-4b1d-bfb6-73fd1762706b-0 Absolutely awesome. c1d9a7b0-7e75-40c0-bb8c-a2b5f0481b9a-0 Thanks, John. f6e7f92f-b1b6-4f9e-a9af-27fa979a76e2-0 So we're going to wrap up here. 45753f80-ae0c-44ee-91e8-6494458e1536-0 If you didn't get a chance to ask a question, you can always 45753f80-ae0c-44ee-91e8-6494458e1536-1 feel free to reach out to us at info@instacuster.com or just 45753f80-ae0c-44ee-91e8-6494458e1536-2 head to our website for any additional resources. fccbb4cb-8e04-4a88-bba2-2219fa1e6c62-0 If you like what you heard today, we also encourage you to fccbb4cb-8e04-4a88-bba2-2219fa1e6c62-1 take a look at our website for more of our upcoming webinars fccbb4cb-8e04-4a88-bba2-2219fa1e6c62-2 and workshops. fb27695a-4db0-4087-91c1-fd0defe57971-0 You know, with that, we'd like to thank everyone again for fb27695a-4db0-4087-91c1-fd0defe57971-1 joining and hope to see you guys again soon. 495a0bed-4266-424f-8b05-1ea44f59128c-0 Thanks.
Explore the impact on efficiency when using Cadence to develop distributed applications and learn about common risks and mitigations when developing a distributed system.