Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wasmcloud/lattice-observer
A reusable Elixir library for monitoring a lattice and deriving observed state
https://github.com/wasmcloud/lattice-observer
elixir lattice nats otp webassembly
Last synced: about 2 months ago
JSON representation
A reusable Elixir library for monitoring a lattice and deriving observed state
- Host: GitHub
- URL: https://github.com/wasmcloud/lattice-observer
- Owner: wasmCloud
- License: apache-2.0
- Created: 2021-10-20T18:54:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-25T16:32:26.000Z (12 months ago)
- Last Synced: 2024-01-25T17:48:21.161Z (12 months ago)
- Topics: elixir, lattice, nats, otp, webassembly
- Language: Elixir
- Homepage: https://wasmcloud.com
- Size: 88.9 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lattice Observer
A reusable Elixir library for monitoring a lattice and deriving observed state.## Usage
The lattice observer is a `GenServer` supervisor that operates a process tree responsible for reacting to events from a lattice and computing derived state from those events.First, you'll want to create a `Gnat.ConnectionSupervisor` with a given name, for example:
```elixir
Supervisor.child_spec(
{Gnat.ConnectionSupervisor, nats_connection_options},
id: :lattice_connection_supervisor
),
```With a running Gnat/NATS connection supervisor, you can then start the NATS lattice observer:
```elixir
{:ok, lattice} = NatsObserver.start_link(
%{
supervised_connection: :lattice_connection_supervisor,
module: MyApp.LatticeWatcher
lattice_prefix: "default"
})
```The `module` argument is the name of a module that must implement the `LatticeObserver.Observer` behavior. This module's `state_changed(state)` function will be invoked when state changes, etc.
For more information, see the hex documentation.