A GenStage Producer which fulfills demand by fetching from an HTTP Server.
If available in Hex, the package can be installed
by adding http_stage to your list of dependencies in mix.exs:
def deps do
[
{:http_stage, "~> 0.2.0"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/http_stage.
Configure HttpStage with the data URL and any request options as a child of your GenStage Supervisor.
opts = [
headers: %{"Authorization" => auth_key},
get_opts: [
params: %{verbose: "true"}
]
]
Supervisor.child_spec(
{
HttpStage,
{"https://example.com/data/source.json", [name: :example_http_data, parser: MyApp.ExampleHttpDataParser] ++ opts}
},
id: :example_http_data
)