This project is the AWS Lambda/Serverless framework-based version of the Eventuate Todo application. The Todo List application lets users maintain a todo list. This example illustrates how you can use develop an application with a microservices architecture that uses the following:
- The Eventuate™ Platform for Event Sourcing and Command Query Responsibility Segregation (CQRS).
- AWS Lambda
- Serverless framework
- The Eventuate AWS Gateway Plugin, which enables a serverless lambda to subscribe to Eventuate events.
To build the app:
./gradlew build
To install the Eventuate AWS Gateway plugin for Serverless:
npm install
or if you are using Vagrant
npm install --no-bin-links
When the todo-queryside-lambda is deployed, this plugin registers it with Eventuate.
When the todo-queryside-lambda undeployed, the plugin unregisters it.
See the serverless.yml
for the details of how the events of interest are specified.
Set the Eventuate environment variables: EVENTUATE_API_KEY_ID
and EVENTUATE_API_KEY_SECRET
.
To deploy the lambdas:
serverless deploy
First, set an environment variable to the root URL. Serverless displays this when you lambdas are deployed. Alternatively, run this command:
export BASE_URL=$(serverless info -v | grep ServiceEndpoint | cut -d' ' -f2)
To create a todo:
curl -d '{"title" : "Say Hello"}' $BASE_URL/todos
Make a note of the id of the created todo, eg.
export ID=xxxx-yyyy
To get the Todo:
curl $BASE_URL/todos/$ID
To get all todos:
curl $BASE_URL/todos
To update a Todo:
curl -X PUT -d '{"title" : "Say Hello Again"}' $BASE_URL/todos/$ID
To delete a Todo:
curl -X DELETE $BASE_URL/todos/$ID
Don't hesitate to create an issue or see