Getting started
The package can be installed from hex as follows.
Add
commanded_eventstore_adapterto your list of dependencies inmix.exs:def deps do [{:commanded_eventstore_adapter, "~> 1.0.0"}] endThen run
mix deps.getCreate an event store for your application:
defmodule MyApp.EventStore do use EventStore, otp_app: :my_app endDefine and configure your Commanded application to use the
Commanded.EventStore.Adapters.EventStoreadapter and your own event store module:defmodule MyApp.Application do use Commanded.Application, otp_app: :my_app, event_store: [ adapter: Commanded.EventStore.Adapters.EventStore, event_store: MyApp.EventStore ] endConfigure the event store in each environment's mix config file (e.g.
config/dev.exs), specifying usage of Commanded's JSON serializer:config :my_app, MyApp.EventStore, serializer: Commanded.Serialization.JsonSerializer, username: "postgres", password: "postgres", database: "eventstore_dev", hostname: "localhost", pool_size: 10Add your event store to
config/config.exsto make it easier to use the event store mix tasks:# config/config.exs config :my_app, event_stores: [MyApp.EventStore]Create the
eventstoredatabase and tables using themixtask:$ mix do event_store.create, event_store.init