Skip to content

Latest commit

 

History

History
104 lines (68 loc) · 2.68 KB

File metadata and controls

104 lines (68 loc) · 2.68 KB

Example Java AWS Lambda function for Eventuate

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:

Building the application

To build the app:

./gradlew build

Installing the plugin

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.

Deploying the lambdas

Set the Eventuate environment variables: EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET.

To deploy the lambdas:

serverless deploy

Accessing the application

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

Got questions?

Don't hesitate to create an issue or see