Amazon AWS Certified Developer Associate – Simple Workflow Service (SWF)

  • By
  • June 4, 2023
0 Comment

1. Introduction to SWF

Through it and just start with what SWF is. So Amazon Simple Workflow Service is a web service that makes it easy to coordinate work across distributed application components. Amazon Simple Workflow enables applications for a range of use cases including media processing, web application, back ends, business process workflows, and analytic pipelines to be designed as coordination of tasks.

Tasks represent invocations of various processing steps in an application, which can be performed by executable code, web service calls, human actions, and scripts. So let’s have a look at an example of what a Simple Workflow would look like. So in this example, basically I want you to imagine Amazon. com. So a customer has gone onto the website, they’ve selected or selected the products they wanted to buy, put it in their shopping cart and they’ve basically placed an order. So that’s where we start. That’s the start point.

And believe it or not, Amazon actually used Simple Workflow in their warehouses from what I’ve been told, to fulfill Amazon. com orders. So they really do use this or they really do practice what they preach. So in this scenario, you’ve got your customer order. The first step is to verify the order. So you have your EC. Two instances, for example, would be your order verifiers they go away and verify perhaps they’re checking that the order is in stock. Whether or not Amazon need to go and order it in based on whether it’s in stock. And you’re going to have a different you need some sort of decision logic here. So you’re going to break this into two different things. You’re going to have workers and deciders and we’ll come to that in the next slide.

Once we know that the order has been verified and you’ve got stock, we’re then going to try and charge the credit card that may or may not go through and that would change the scope of the workflow. Again, you’re going to need a worker and a decider. If the credit card has, the charge has been successful, we’re then going to ship the order.

So now you need human interaction. You need a human to go and get a toy. Let’s say Christmas is coming up and the parents have ordered a toy. Let’s say a fire truck. And somebody in the warehouse actually has to go and locate that fire truck. So they’ll get a notice on their PDA, might be using SNS, but let’s not confuse the issue. And they will go and get the fire truck. Once the fire truck has been boxed up and it’s ready to go, the human worker would then say, okay, I’ve marked this for shipment, it’s good to go.

And then there will be record completion. And in this there’ll be basically be a database saying, yes, it has been shipped, it has gone out the door, it’s been boxed up and it’s on its way. Here’s the tracking number. And then that’s the end of this particular workflow. So hopefully that example makes it a bit easier for you. So for the exam, you’re going to need to know what workers are, what deciders are. So a worker is a program that interacts with Amazon’s Simple Workflow Service to get tasks processed, receive tasks, and then return results. So basically, it’s going to get the task, process that task and then return a result for it. A decider is a program that controls the coordination of tasks, ie. They’re ordering concurrency and scheduling according to the application logic.

So the worker and decider can run on cloud infrastructure such as Amazon EC Two or on machines behind Firewalls. Amazon’s Simple Workflow brokers the interactions between workflows and deciders and the decider. It allows the decider to get a consistent view into the progress of tasks and to initiate new tasks in an ongoing manner.

At the same time, Amazon Simple Workflow stores tasks, assigns them to workers when they are ready, and monitors their progress. It ensures that a task is assigned only once and is never duplicated. Now that’s a really, really key point for your exam. The difference and the main difference between Simple Workflow and SQS is with Simple Workflow, a task is only assigned once and it is never duplicated. With SQS, you’ve got your message visibility timeout.

A task can be assigned multiple times and it could also be duplicated if something doesn’t complete in a certain length of time that will then go back to the Sqsq and it could be done twice accidentally. So the main difference between SWF and SQS is that with Simple Workflow Service, a task is only assigned once and is never duplicated.

Since Amazon’s Simple Workflow maintains the application state’s, durability, workers and deciders don’t have to keep track of Execution state, they can run independently and scale quickly. So if you remember the example where we had the factory, that decision logic is part of a domain. So a Simple Workflow domain is simply your workflow and activity types and the Workflow Execution itself are all scoped to a domain.

So think of a domain as a container. Domains isolate a set of types, execution and task lists from others within the same account. You can register a domain by using the AWS Management console or by using the Registered domain action. In the Amazon Simple Workflow API. The parameters are specified in JavaScript or JSON JavaScript object notation or JSON format.

So this would be a typical JSON domain registration. So you’ve got your name, you’ve got your description, and then you’ve got your Workflow Execution retention period, which is in days. How long is the retention period for this particular workflow? And then that brings on another point, which is an exam question. If you remember. With SQS, the maximum time you can have an SQS message in the queue is basically for 12 hours.

With Simple Workflow, your maximum workflow can be one year and the value is always measured in seconds. So again, if you’re being asked to compare a, you know, compare the two between Simple Workflow and SQS. SQS is much shorter time frames. We’re only talking 12 hours, whereas Simple Workflow is up to one year. So that really brings us on to the last slide, which is comparing SWF with SQS. So SWF presents a task orientated API. Whereas Amazon’s SQS offers a message orientated API. Amazon Simple Workflow ensures that a task is assigned only once and is never duplicated. With Amazon SQS, you need to handle duplicated messages and may also need to ensure that a message has been processed only once.

Amazon’s Simple Workflow keeps track of all the tasks and events in an application. With Amazon’s Simple Queue Service, you need to implement your own application level tracking, especially if your application uses multiple queues. So that’s it for this lecture on Simple Workflow service. It probably will only come up in one or two questions, and it’s basically going to be asking you where you should use Simple Workflow versus using SQS. And to be honest, sometimes those questions can be really tough. You have to sit there and think about it. The main thing I would consider if I was you is does the question involve any kind of human interaction? In which case you would be looking for Simple Workflow.

And then the other thing is, in terms of delivery time frames, are you looking for a twelve hour window or are you looking for something that’s going to be longer? And also if it might give you hints about talking about domains or workers and deciders those sorts of language or words are used, hint towards using Simple Workflow versus Simple Queue Services. If you’d see something in the exam that we haven’t covered, please let me know. And if you have any questions, also, please let me know. If you have the time, please move on to the next lecture. Thank you.

Comments
* The most recent comment are at the top

Interesting posts

SAP-C02 Amazon AWS Certified Solutions Architect Professional – Exam Preparation Guide Part 5

5. Exam Preparation – Domain 4 Hey everyone and welcome back. In today’s video we will be discussing about the important pointers for exams for domain four. So the first thing here is that you should know about tagging strategies, about resource groups, about the EC to pricing models here then the overview about S… Read More »

SAP-C02 Amazon AWS Certified Solutions Architect Professional – Exam Preparation Guide Part 4

4. Exam Preparation – Domain 3 Hey everyone and welcome back. Now in today’s video for important pointers for exams our focus would be on domain three. So the domain three is migration planning and it constitutes to be 15% of the examination. So let’s get started and see what are some of the important… Read More »

SAP-C02 Amazon AWS Certified Solutions Architect Professional – Exam Preparation Guide Part 3

3. Exam Preparation Part 02 – Domain 2 Hey everyone, and welcome back. Now, in today’s video, we will be continuing our journey, understanding some of the important pointers for exams for domain two. As we have discussed, even in the earlier video, be aware about the distinction on which use cases where DynamoDB would… Read More »

SAP-C02 Amazon AWS Certified Solutions Architect Professional – Exam Preparation Guide Part 2

2. Exam Preparation Part 01 – Domain 2 Hey everyone and welcome back in today’s video for important pointers. For exam, our focus would be on domain two. Now the domain two, which is designed for new solutions is one of the largest domains of this certification both in terms of the number of topics… Read More »

SAP-C02 Amazon AWS Certified Solutions Architect Professional – Exam Preparation Guide

1. Exam Preparation – Domain 1 Hey everyone and welcome back. Now in today’s video we will be discussing about some of the important pointers for exam as far as the domain one is concerned. Now the domain one is basically designed for organizational complexity and it constitutes to be twelve 5% of the overall… Read More »

SAP-C02 Amazon AWS Certified Solutions Architect Professional – New Domain 5 – Continuous Improvement for Existing Solutions Part 18

69. Building the function for our API Hey everyone and welcome back. Now in the earlier lecture we discussed that there are two important components that we need. The first is the function and second is the API. So what we’ll be doing today is we will be creating a function after function is created.… Read More »

img