View Source EventStore.PubSub (EventStore v1.4.1)

Pub/sub using Elixir's local Registry module.

Link to this section Summary

Functions

Broadcasts message on given topic.

Return the child spec.

Subscribes the caller to the given topic.

Link to this section Functions

Link to this function

broadcast(event_store, topic, message)

View Source
@spec broadcast(EventStore.t(), binary(), term()) :: :ok

Broadcasts message on given topic.

@spec child_spec(EventStore.t()) :: [:supervisor.child_spec()]

Return the child spec.

Link to this function

subscribe(event_store, topic, opts \\ [])

View Source
@spec subscribe(
  EventStore.t(),
  binary(),
  selector: (EventStore.RecordedEvent.t() -> any()),
  mapper: (EventStore.RecordedEvent.t() -> any())
) :: :ok | {:error, term()}

Subscribes the caller to the given topic.