Chronicle.ExternalServices (cratis_chronicle v2.2.0)

Copy Markdown View Source

Idiomatic API for registering external service definitions with Chronicle.

External services let the Chronicle kernel talk to systems outside the event store — an HTTP API or a MsSql/PostgreSql database — under a name other kernel features (such as captures) can reference.

Registration

:ok =
  Chronicle.ExternalServices.register("payments-api", fn builder ->
    builder
    |> Chronicle.ExternalServices.DefinitionBuilder.http("https://payments.example.com")
    |> Chronicle.ExternalServices.DefinitionBuilder.with_bearer_token(
      System.fetch_env!("PAYMENTS_API_TOKEN")
    )
  end)

Options

Summary

Functions

Registers an external service.

Functions

register(name, configure, opts \\ [])

Registers an external service.

configure receives a Chronicle.ExternalServices.DefinitionBuilder and must return it (or a continuation of it) after configuring the endpoint.