BrookStoragePostgres

Brook Storage Postgres implements the Brook Storage plugin behaviour to provide the View State persistence to Elixir applications including the Brook library for event-driven distibuted application orchestration.

For more on Brook, you can review the source and read the docs on Hex.pm.

Brook Storage Postgres supports the following operations of the Brook storage behaviour:

Installation

Brook Storage Postgres can be included in your application by adding the following to your mix.exs file.

def deps do
  [
    {:brook_storage_postgres, "~> 0.1.2"}
  ]
end

Configuration

From your application runtime or config files, or anywhere in your code where Brook configuration is generated and passed to the Brook Supervisor start_link/1 function, include the following block specifying the storage module with the necessary information to use Brook Storage Postgres:

brook_config = [
  instance: ...instance name...
  driver: %{...driver config here...},
  handlers: [...handler list here...],
  storage: %{
    module: Brook.Storage.Postgres,
    init_arg: [
      table: "table_name",
      postgrex_args: [
        hostname: "db_host",
        username: "app_svc_name",
        password: "app_svc_password",
        database: "db_engine"
      ],
      event_limits: %{
        "data:something" => 100,
        "data:something:else" => 50
      }
    ]
  }
]

The docs be found at https://hexdocs.pm/brook_storage_postgres.