brook v0.6.0 Brook.Event
The Brook.Event
struct is the basic unit of message written to
and read from the event stream. It encodes the type of event (for
application event handlers to pattern match on), the author (source application),
The creation timestamp of the message, the actual data of the message,
and a boolean detailing if the message was forwarded within the Brook
Server process group.
The data component of the message is an arbitrary Elixir term but is typically a map or struct.
Link to this section Summary
Functions
Process a Brook.Event
struct via synchronous call to the Brook.Server
Send a message to the Brook.Server
synchronously, passing the term to be encoded into a
Brook.Event
struct, the authoring application, and the type of event. The event type must
implement the String.Chars.t
type.
Takes a Brook.Event
struct and a function and updates the data value of the struct
based on the outcome of applying the function to the incoming data value. Merges the resulting
data value back into the struct.
Link to this section Types
t()
t() :: %Brook.Event{ author: Brook.author(), create_ts: pos_integer(), data: data(), forwarded: boolean(), type: String.t() }
Link to this section Functions
new(data)
process(instance, event)
process(Brook.instance(), Brook.Event.t() | term()) :: :ok | {:error, Brook.reason()}
Process a Brook.Event
struct via synchronous call to the Brook.Server
send(instance, type, author, event)
send(Brook.instance(), Brook.event_type(), Brook.author(), Brook.event()) :: :ok | {:error, Brook.reason()}
Send a message to the Brook.Server
synchronously, passing the term to be encoded into a
Brook.Event
struct, the authoring application, and the type of event. The event type must
implement the String.Chars.t
type.
send(instance, type, author, event, driver)
send( Brook.instance(), Brook.event_type(), Brook.author(), Brook.event(), driver() ) :: :ok | {:error, Brook.reason()}
update_data(event, function)
update_data(Brook.Event.t(), (data() -> data())) :: Brook.Event.t()
Takes a Brook.Event
struct and a function and updates the data value of the struct
based on the outcome of applying the function to the incoming data value. Merges the resulting
data value back into the struct.