Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation improvements #304

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/gen_stage/dispatcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ defmodule GenStage.Dispatcher do
fixed amount of consumers that works as partitions according
to a hash function.

> ### Dispatcher State {: .info }
>
> Note that the Dispatcher state is stored separately from the state of the
> `GenStage` itself and neither side will have direct access to the state of
> the other.

"""

@typedoc "Options used by `init/1`"
Expand Down Expand Up @@ -84,11 +90,13 @@ defmodule GenStage.Dispatcher do
exists, meaning they must be returned as left_over events until
another consumer subscribes.

It is guaranteed the reference given in `from` points to a
reference previously given in subscribe. It is also recommended
for events to be sent with `Process.send/3` and the `[:noconnect]`
option as the consumers are all monitored by the producer. For
example:
This callback is responsible for sending events to consumer
stages. In order to do so, you must store a `from` value from a
josevalim marked this conversation as resolved.
Show resolved Hide resolved
previous `ask/3` callback.

It is recommended for these events to be sent with `Process.send/3`
and the `[:noconnect]` option as the consumers are all monitored
by the producer. For example:

Process.send(consumer, {:"$gen_consumer", {self(), consumer_ref}, events}, [:noconnect])

Expand Down