A graph streaming engine written in Elixir
Add weaver to your list of dependencies in mix.exs:
def deps do
[
{:weaver, github: "weaver-engine/weaver"}
]
endTo use Loom, also add the forked version of GenStage:
def deps do
[
{:weaver, github: "weaver-engine/weaver"},
{:gen_stage, github: "weaver-engine/gen_stage", branch: "prosumer"}
]
endThe fork is equivalent to GenStage, except some checks are removed to
allow for producer modules to also subscribe to other Producers (see
diff
and issue comment
by José Valim).
While Weaver.weave only runs a single step at a time and returns the results,
Loom helps to run all required steps and streams the results. Under the hood it
supervises a topology of GenStage workers that you can run as part of your
supervision tree:
defmodule MyApp.Application do
...
def start(_type, _args) do
children = [
...
Weaver.Loom
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
endTo stream a query, call Weaver.Loom.weave.