ExESDBGater.Repl (ex_esdb_gater v0.0.6)
This module is to interact with the ExESDB.system, running a store called "reg_gh" (Regulate Greenhouse)
Summary
Functions
Append events to a stream.
Starts an observer (a transient subscription) for all streams.
Starts an observer (a transient subscription) for a specific event payload pattern. ## Parameters
Starts an observer for a specific event type. ## Possible event types
Starts an observer (a transient subscription) for a specific stream. ## Parameters
Starts a number of producers.
Each producer will append events to a stream with stream id greenhouse-n
.
Where n is the number of the producer.
Starts a subscriber for a specific stream. ## Parameters
Stops a producer for a specific stream_id.
Functions
@spec append( stream :: atom(), nbr_of_events :: integer() ) :: {:ok, list(), integer()} | {:error, term()}
Append events to a stream.
@spec start_observer_for_all_streams() :: :ok
Starts an observer (a transient subscription) for all streams.
Starts an observer (a transient subscription) for a specific event payload pattern. ## Parameters
- observer_name: the name of the observer
- event_payload_pattern: the event payload pattern as a map (e.g.: %{operator: "John"})
@spec start_observer_for_event_type(event_type :: String.t()) :: :ok
Starts an observer for a specific event type. ## Possible event types:
- "initialized:v1" (default)
- "temperature_measured:v1"
- "humidity_measured:v1"
- "light_measured:v1"
- "fan_activated:v1"
- "fan_deactivated:v1"
- "light_activated:v1"
- "light_deactivated:v1"
- "heater_activated:v1"
- "heater_deactivated:v1"
- "sprinkler_activated:v1"
- "sprinkler_deactivated:v1"
- "desired_temperature_set:v1"
- "desired_humidity_set:v1"
- "desired_light_set:v1"
@spec start_observer_for_stream(stream :: String.t()) :: :ok
Starts an observer (a transient subscription) for a specific stream. ## Parameters
- stream: the stream to subscribe to (default: "$greenhouse-1")
Starts a number of producers.
Each producer will append events to a stream with stream id greenhouse-n
.
Where n is the number of the producer.
@spec start_subscriber_for_stream( subscription_name :: String.t(), stream :: String.t(), start_from :: integer() ) :: :ok
Starts a subscriber for a specific stream. ## Parameters
- subscription_name: the name of the subscription
- stream: the stream to subscribe to (default: "$greenhouse-1")
- start_from: the version to start from (default: 0)
@spec stop_producer_for_stream(stream_id :: String.t()) :: :ok
Stops a producer for a specific stream_id.