Skip to content

Instantly share code, notes, and snippets.

@softberries
Created March 21, 2023 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softberries/552ad6029f0195a4fdd2189c278586c1 to your computer and use it in GitHub Desktop.
Save softberries/552ad6029f0195a4fdd2189c278586c1 to your computer and use it in GitHub Desktop.
@default_partition 0
defp partition(msg) do
case Jason.decode(msg.data) do
{:ok, data} ->
:erlang.phash2(data["ride_id"])
_ ->
:default_partition
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment