Aws Step Functions Plagiarism Demo Dotnetcore Save

A simple workflow for developing AWS Step Functions to demonstrate how you can combine AWS Step Functions with AWS Lambda using .NET 6 and the Serverless Application Model (SAM), and expose your workflow via an API Gateway!

Project README

AWS Step Functions Plagiarism Demo .NET

Welcome! This a simple workflow to demonstrate how you can combine AWS Step Functions with AWS Lambda, Amazon DynamoDB, AWS XRay, using Microsoft .NET Core.

Along the way we provide an example of how to integrate Amazon API Gateway with AWS Step Functions, and use the AWS Step Function Service Integration Callback Pattern, to interface with an external website from a manual process in the workflow.

You will also see how we use the AWS Serverless Application Model (SAM) to define and model your Serverless application, and use AWS SAM CLI to build and deploy it.

The Scenario

To illustrate the use of AWS Step Functions I have created a scenario that describes a process where university students caught plagiarising on exams and/or assignments are required to take a test to assess their knowledge of the universities referencing standards.

Visually, the process looks like this:

Developing With Step Functions

The process starts by:

  1. Registering the plagiarism incident
  2. Scheduling an exam. Students have one week to complete the test.
  3. Send the student an email notification to inform them of the requirement
  4. The process waits for the student to complete the exam, then
  5. Determining whether or not the student has sat the exam, or passed

If the student has fails the exam they are allowed to resit the exam. Students get 3 attempts to pass the exam before the incident is either resolved, or administrative action is taken.

The Architecture

Developing With Step Functions Architecture

The architecture is relatively simple. There are two front end websites - one "Admin" website that capture the plagiarism incident; and a "Testing Centre" that tests the students knowledge of plagiarism.

The incident captured at via the Admin website initiates the AWS Step Function execution through an AWS Service integration on the /incident resource for the POST method.

Integration Request

Once the the exam is scheduled, we use an AWS Lambda service integration Task with a .waitForTaskToken (see AWS docs). The Task Token is passed to the function which in turn generates the email which is sent to the student, notifying them of the exam requirements.

"SendNotification": {
    "Type": "Task",
    "Comment": "Send email confirming exam details and exam deadline. Wait for callback.",
    "Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken",
    "Parameters":{
    "FunctionName":"${SendExamNotificationFunction}",
    "Payload":{
        "input.$":"$",
        "TaskToken.$":"$$.Task.Token"
    }
    },
    "Next": "HasStudentPassedExam"
},

Once the student receives the email, the Task Token is passed to the Testing Centre. The student answers the questions and submits the results to the /exam resource on the API. The Lambda integration processes the TaskToken and passes the results of the waiting execution to continue the workflow execution.

Resources

Step Functions

References

AWS Developer Resources

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

Open Source Agenda is not affiliated with "Aws Step Functions Plagiarism Demo Dotnetcore" Project. README Source: aws-samples/aws-step-functions-plagiarism-demo-dotnetcore

Open Source Agenda Badge

Open Source Agenda Rating