Skip to content

Instantly share code, notes, and snippets.

@matlc
Created November 29, 2018 01:24
Show Gist options
  • Save matlc/16bcca6a9b7636f46ad29383d55af609 to your computer and use it in GitHub Desktop.
Save matlc/16bcca6a9b7636f46ad29383d55af609 to your computer and use it in GitHub Desktop.
def start_flow do
streams()
|> Flow.from_enumerables()
|> Flow.filter(&Regex.match?(~r/publishing/, &1))
|> Flow.map(&get_key_and_payload(&1))
|> Flow.partition(key: {:elem, 0})
|> Flow.reduce(fn -> %{} end, fn x, acc ->
Map.put_new(acc, elem(x, 1), elem(x, 2))
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment