If available in Hex, the package can be installed
by adding brodex
to your list of dependencies in mix.exs
:
def deps do
[
{:brodex, git: "https://github.com/PRAVALER/brodex"}
]
end
See config/config.exs for a description of configuration variables, including the Kafka broker list and default consumer group.
import Config
alias BrodexExampleWeb.ConsumerTest
config :brodex,
kafka_topics: [
%{name: :topic_test, topic: "topic-test", partitions: :all, module: ConsumerTest}
]
To use a consumer group, first implement a handler module using
Brodex.Consumer
.
defmodule BrodexExampleWeb.ConsumerTest do
use Brodex.Consumer
@impl true
def handler(data) do
IO.inspect(data, label: "data")
{:ok, true}
end
end