Module gen_stage_demand_dispatcher

Function Index

ask/3
cancel/2
dispatch/3
info/2
init/1 A dispatcher that sends batches to the highest demand.
subscribe/3

Function Details

ask/3

ask(Counter, X2, X3) -> any()

cancel/2

cancel(X1, X2) -> any()

dispatch/3

dispatch(Events, Length, X3) -> any()

info/2

info(Msg, State) -> any()

init/1

init(Opts) -> any()

A dispatcher that sends batches to the highest demand.

This is the default dispatcher used by gen_stage. In order to avoid greedy consumers, it is recommended that all consumers have exactly the same maximum demand.

Options: - shuffle_demands_on_first_dispatch: when true, shuffle the initial demands list which is constructed on subscription before first dispatch. It prevents overloading the first consumer on first dispatch. Defaults to false. - max_demand: the maximum demand expected on gen_stage:ask/3. Defaults to the first demand asked.

Examples

To start a producer with demands shuffled on first dispatch:

{producer, State, [{dispatcher, {gen_stage_demand_dispatcher, [{shuffle_demands_on_first_dispatch, true}]}}]}

subscribe/3

subscribe(Opts, X2, X3) -> any()


Generated by EDoc