# `Decree.Store.PubSub`
[🔗](https://github.com/sparkle-space/decree/blob/v0.1.0/lib/decree/store/pubsub.ex#L1)

Pub/sub using Elixir's local `Registry` module.

# `broadcast`

```elixir
@spec broadcast(Decree.Store.t(), binary(), term()) :: :ok
```

Broadcasts message on given topic.

# `child_spec`

```elixir
@spec child_spec(Decree.Store.t()) :: [:supervisor.child_spec()]
```

Return the child spec.

# `subscribe`

```elixir
@spec subscribe(Decree.Store.t(), binary(),
  selector: (Decree.Store.RecordedEvent.t() -&gt; any()),
  mapper: (Decree.Store.RecordedEvent.t() -&gt; any()),
  notices: boolean()
) :: :ok | {:error, term()}
```

Subscribes the caller to the given topic.

`notices: true` also sends the caller `{:events_pending, event_number}` when the publisher
stops a batch before an event whose type this instance does not know. A subscription
process registers with it; an aggregate or a transient subscriber does not.

The publisher cuts each notification's batch on its own: an event appended after the
unknown one, in a later append, is still broadcast. A subscriber without notices checks
`stream_version` or `event_number` continuity itself.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
