1 00:00:03,200 --> 00:00:07,950 welcome back to back space Academy in this lecture I'm going to go through a 2 00:00:07,950 --> 00:00:14,309 high-level overview of the simple workflow service or SWF for short for 3 00:00:14,309 --> 00:00:18,590 the associate level certifications you're going to need to have just a 4 00:00:18,590 --> 00:00:23,609 understanding of SWF you're not going to need to be an expert in applying and 5 00:00:23,609 --> 00:00:26,369 study with and using it from a hands-on perspective but you do need to 6 00:00:26,369 --> 00:00:32,369 understand what the terminology around SWF how it works how you would implement 7 00:00:32,369 --> 00:00:39,179 it and what and what an example of it would look like. SWF it coordinates 8 00:00:39,179 --> 00:00:44,639 work across distributed application components and it helps implement 9 00:00:44,639 --> 00:00:49,999 complex business processes and application workflows it's suitable for 10 00:00:49,999 --> 00:00:54,869 long-running execution it's not really suitable it can be used for batch 11 00:00:54,869 --> 00:01:00,389 processes but it's more suitable for long-running processes for business 12 00:01:00,389 --> 00:01:05,400 processes and for long-running workflows and enables complex interactions between 13 00:01:05,400 --> 00:01:11,250 a different applications on different platforms between AWS and on-premise 14 00:01:11,250 --> 00:01:20,789 infrastructure and even with different users on AWS the features of SWF the 15 00:01:20,789 --> 00:01:26,219 tasks are executed with no duplicates the routing it provides routing and 16 00:01:26,219 --> 00:01:31,590 queuing of the tasks and it also provides timeout and execution status of 17 00:01:31,590 --> 00:01:37,320 tasks and the workflows they can have child workflow so you can have a 18 00:01:37,320 --> 00:01:43,469 hierarchy of workflows it also allows the user data input and execution of 19 00:01:43,469 --> 00:01:52,619 results to be output as well the components of SWF a workflow that is the 20 00:01:52,619 --> 00:01:57,990 control flow logic for the execution of tasks it's like our our business process 21 00:01:57,990 --> 00:02:04,049 flow or our workflow so that is the control flow logic and then we have a 22 00:02:04,049 --> 00:02:10,349 domain and that contains a work flow or a number of workflows and we have tasks 23 00:02:10,349 --> 00:02:15,510 and they can be performed by executable code they can be a web service call or 24 00:02:15,510 --> 00:02:20,670 they can even be an end user input they can be performed in parallel or Sara Lee 25 00:02:20,670 --> 00:02:27,420 and so they form the basis of our workflow then we have actors and the 26 00:02:27,420 --> 00:02:36,120 actors interact directly with SWF to coordinate tasks so what is an actor so 27 00:02:36,120 --> 00:02:43,069 an actor can be a workflow starter it can be a decider or an activity worker a 28 00:02:43,069 --> 00:02:53,010 workflow starter that can initiate the execution of a workflow a decider that 29 00:02:53,010 --> 00:02:58,470 implements the workflow logic and notifies SWF of changes during the 30 00:02:58,470 --> 00:03:03,629 workflow execution and the activity figures will they do the work so they 31 00:03:03,629 --> 00:03:12,780 perform the activity tasks of the workflow tasks must be registered using 32 00:03:12,780 --> 00:03:18,329 either the console or register activity type action which you can do through the 33 00:03:18,329 --> 00:03:25,049 API and CLI as well when scheduled you can specify a task 34 00:03:25,049 --> 00:03:31,739 list which is a basically a queue and decision and activity tasks they have 35 00:03:31,739 --> 00:03:38,819 separate lists or queues particular tasks can be assigned to a particular 36 00:03:38,819 --> 00:03:47,220 activity workers you've required through task routing. SWF it's implemented by 37 00:03:47,220 --> 00:03:53,760 having communication between the swf service and our applications so our 38 00:03:53,760 --> 00:03:59,129 applications can communicate to SWF through the software development kits 39 00:03:59,129 --> 00:04:04,409 that are available for a number of languages through the SWF API and that 40 00:04:04,409 --> 00:04:11,459 allows us to do HTTP POST calls to the API and we also have a flow framework 41 00:04:11,459 --> 00:04:18,479 which is available for Java or Ruby which also has a number of features that 42 00:04:18,479 --> 00:04:27,510 simplify creating communication paths to SWF an SWF can also be set up using the 43 00:04:27,510 --> 00:04:32,670 console or the command line interface so what does an 44 00:04:32,670 --> 00:04:39,300 example look like of SWF workflow so here is a very simple example that was 45 00:04:39,300 --> 00:04:44,520 on the AWS website so it's for a video transcoding a transcoding application 46 00:04:44,520 --> 00:04:50,340 and it's a very simple process that just grabs a video in codes at video and adds 47 00:04:50,340 --> 00:04:55,410 digital rights management or copyright protection to that video and then it 48 00:04:55,410 --> 00:05:01,080 finishes so we have actors as we remember from the previous slide we have 49 00:05:01,080 --> 00:05:10,320 workflow starters we have workers and we also have decider actors so L started 50 00:05:10,320 --> 00:05:14,130 our process there we can see in the middle there Amazon SWS we have in code 51 00:05:14,130 --> 00:05:19,590 tasks DRM tasks and we also have decide at asset that occur there that make 52 00:05:19,590 --> 00:05:24,870 decisions within that workflow so it starts there with our web server front-end 53 00:05:24,870 --> 00:05:29,520 that is our workflow starter it's our starter actor and that will accept the 54 00:05:29,520 --> 00:05:38,430 video URL and that will communicate with Amazon SWF to start the process to start 55 00:05:38,430 --> 00:05:48,090 this workflow from there swf will create a task for encoding and it will put that 56 00:05:48,090 --> 00:05:53,910 task into a task list and it will sit there until such time as an activity 57 00:05:53,910 --> 00:06:01,200 worker is available to do that task when that task is finished it will return the 58 00:06:01,200 --> 00:06:08,220 results and those results will be looked at by the decider actor and then the 59 00:06:08,220 --> 00:06:16,790 decider will decide or will communicate back to the SWF service and from there 60 00:06:16,790 --> 00:06:21,930 if everything is ok it will go on to the next task being the DRM task and again 61 00:06:21,930 --> 00:06:28,650 that will go into another task list and when a worker is available then that 62 00:06:28,650 --> 00:06:33,570 task will be completed and then we go back the decider will decide that the 63 00:06:33,570 --> 00:06:39,030 execution has been completed and that will be the end of that process so 64 00:06:39,030 --> 00:06:44,350 that's a very simple application but as you can see SWF 65 00:06:44,350 --> 00:06:50,169 takes a lot of the headache out of implementing business processes to 66 00:06:50,169 --> 00:06:55,540 implementing workflows in a very systematic way so that the end of that 67 00:06:55,540 --> 00:07:01,290 lesson on SWF and I look forward to you in the next ones