EventSourcery::DynamoDB
The following EventSourcery functionality has been implemented for DynamoDB
Installation
Add the following to your Gemfile
gem 'event_sourcery-dynamodb', git: 'git@github.com:envato/event_sourcery-dynamodb.git'
Usage
Ensure you have the following environment variables set:
- AWS_REGION
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
Event Tracker
require 'event_sourcery/dynamodb'
dynamodb_client = Aws::DynamoDB::Client.new
tracker = EventSourcey::DynamoDB::Tracker.new(
dynamodb_client,
table_name: 'event_trackers'
)
Development
In development a local Dynamodb
instance is installed. To start up the DynamoDB local instance run:
bundle exec dynamodb-local
This starts up a dynamodb instance running on port 8000. You can connect to the instance by:
require 'event_sourcery/dynamodb'
dynamodb_client = Aws::DynamoDB::Client.new(endpoint: 'http://localhost:8000')
tracker = EventSourcey::DynamoDB::Tracker.new(
dynamodb_client,
table_name: 'event_trackers'
)