#cqrs #event-sourcing #serverless

dynamo-es

A DynamoDB implementation of an event repository for cqrs-es

8 releases

Uses new Rust 2021

0.4.3 Jun 2, 2022
0.4.2 May 18, 2022
0.4.0 Apr 28, 2022
0.3.2 Apr 19, 2022
0.0.1 Dec 30, 2021

#5 in #dynamodb

Download history 2/week @ 2022-03-10 28/week @ 2022-03-17 3/week @ 2022-03-24 1/week @ 2022-03-31 2/week @ 2022-04-07 40/week @ 2022-04-14 7/week @ 2022-04-21 48/week @ 2022-04-28 31/week @ 2022-05-05 112/week @ 2022-05-12 55/week @ 2022-05-19 25/week @ 2022-05-26 92/week @ 2022-06-02 11/week @ 2022-06-16

136 downloads per month

Apache-2.0

56KB
1K SLoC

dynamo-es

A DynamoDB implementation of the PersistedEventRepository trait in cqrs-es.

DynamoDb caveats

AWS' DynamoDb is fast, flexible and highly available, but it does make some limitations that must be considered in the design of your application.

  • Maximum limit of 25 operations in any transaction - Events are inserted in a single transaction, this means that a command can not produce more than 25 events using Event store, or 24 events if using Snapshot or Aggregate store. This is rare but if a command might produce more than this limit a different backing database should be used.
  • Item size limit of 400 KB - An event should never reach this size, but it is possible that a serialized aggregate might. If this is possible for your use case beware of using Aggregate or Snapshot stores.
  • Maximum request size of 1 MB - This may have the same ramifications as the above for Aggregate or Snapshot stores. Additionally, large numbers of events may reach this threshold. To prevent an error while loading or replaying events, set the streaming channel size to a number that ensures you won't exceed this threshold.

Testing

Requires access to DynamoDb with existing tables. This can be created locally using the included docker-compose.yml file with CLI configuration of test tables included in the Makefile.

To prepare a local test environment (requires a local installation of Docker and AWS CLI):

  • docker-compose up -d
  • make configure

Note that this crate used the AWS DynamoDb Rust SDK, which is currently in Developer Preview. This means that any bugs will be addressed but the underlying interfaces may still be changed resulting in significant changes within this crate. See the AWS SDK public roadmap for more information.

It is recommended that tables are configured to allow only transactions. See: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis-iam.html


Things that could be helpful:

Crates.io docs build status

Dependencies

~20MB
~429K SLoC