Quantum v2.1.3 Quantum.JobBroadcaster View Source
This Module is here to broadcast added / removed tabs into the execution pipeline.
Link to this section Summary
Link to this section Functions
Invoked on :producer
stages.
This callback is invoked on :producer
stages with the demand from
consumers/dispatcher. The producer that implements this callback must either
store the demand, or return the amount of requested events.
Must always be explicitly implemented by :producer
stages.
Examples
def handle_demand(demand, state) do
# We check if we're able to satisfy the demand and fetch
# events if we aren't.
events =
if length(state.events) >= demand do
state.events
else
# fetch_events()
end
# We dispatch only the requested number of events.
{to_dispatch, remaining} = Enum.split(events, demand)
{:noreply, to_dispatch, %{state | events: remaining}}
end
Callback implementation for GenStage.handle_demand/2
.
Link to this function
start_link(name, jobs)
View Source
start_link(GenServer.server, [Quantum.Job.t]) :: GenServer.on_start
Start Job Broadcaster
Arguments
name
- Name of the GenStagejobs
- Array ofQuantum.Job