serverless-cqrs
  • Introduction
  • Quickstart
  • Domain
  • Testing
  • Examples
    • Express
    • GraphQL
  • Advanced
    • Adapter Interface
      • Write Model
      • Read Model
    • Deploy
    • Authorization
    • Eventual Consistency
    • Multiple Aggregates
  • Components
    • serverless-cqrs
    • write-model
      • repositoryBuilder
      • commandServiceBuilder
    • read-model
    • memory-adapter
    • dynamodb-adapter
    • elasticsearch-adapter
Powered by GitBook
On this page
  • Description
  • Methods
  • Examples

Was this helpful?

  1. Advanced

Adapter Interface

PreviousGraphQLNextWrite Model

Last updated 6 years ago

Was this helpful?

Description

Adapters allow us to persist events (for the write model) and/or projections (for the read model).

If you can't find an adapter for your favorite database, you can build one by implementing the Adapter Interface.

The Adapter Interface has two sets of methods, depending if you are persisting events, projections, or both. Not every database is suitable for storing both. DynamoDB, for example, is very well suited for storing events, but lacks the search capabilities which are useful when storing projections. ElasticSearch, on the other hand, is great for storing, and searching, arbitrary JSON objects (projections) but is not very well suited for a stack of events.

When implementing the Adapter Interface, you can choose which set of methods to implement.

Methods

Examples

Write Model
Read Model
dynamodb-adapter
elasticsearch-adapter
memory-adapter