View Source Strom.Topology (strom v0.7.2)
Runs set of components. Restarts all of them in case of crash.
Provides start
, stop
, call
function on the module level.
Starts topology as a process with the topology module name.
So only one topology with the given name can exist.
## Example:
iex> defmodule OddEvenTopology do
...> use Strom.Topology
...> alias Strom.Sink.Null
...>
...> def topology(_opts) do
...> [
...> Source.new(:s1, [1, 2, 3]),
...> Source.new(:s2, [4, 5, 6]),
...> Mixer.new([:s1, :s2], :s),
...> Transformer.new(:s, &(&1 + 1)),
...> Splitter.new(:s, %{odd: &(rem(&1, 2) == 1), even: &(rem(&1, 2) == 0)}),
...> Sink.new(:odd, Null.new(), true)
...> ]
...> end
...> end
iex> OddEvenTopology.start()
iex> %{even: even} = OddEvenTopology.call(%{})
iex> OddEvenTopology.stop()
iex> Enum.sort(Enum.to_list(even))
[2, 4, 6]
Summary
Functions
Returns a specification to start this module under a supervisor.