Prerequisites

Introduction

MQLess is much simpler than Akka, for better and for worst, some of the differences:

MQLess doesn't have hierarchy or supervisors.

MQLess doesn't manage the state (yet) - you need to manage the state elsewhere (like Redis or DynamoDB)

MQLess actor always exists, virtually. You don't need to create or stop actors, just send them a message.

MQLess is not a cluster, actors' messages are executed on AWS Lambda instances, MQLess is the router in front of Lambda.

MQLess is language agnostic, you can write your actors in any language supported by AWS Lambda.

In this tutorial, we will use NodeJS and Javascript.

The Example

Internet of Things (IoT) system that reports temperature from sensor devices installed in customers’ homes. The target use case allows customers to log in and view the last reported temperature from different areas of their homes.

Create a new project

Create a new NodeJS project by running npm init -y in a new directory. The -y flag generates a project without having it ask any questions.
Currently, the only dependency is the aws-sdk for NodeJS, so run npm install --save aws-sdk.

Actor State

As mentioned above, MQLess doesn't manage the state. We need to save the actor state at an external storage. In this tutorial we will use DynamoDB.

As all of our actors need to manage state, let's create a shared module to handle state.
Create state.js under the src directory and copy the following:

The above code instructs AWS to create a Dynamodb table as part of deploying our package.

SAM doesn't create the table when running locally, so we need to create the table manually.
However you probably already did that if you follow the 'Install MQLess locally' guide.
Anyway, following is the snippet to install it locally.