brodex v0.0.2 Brodex View Source
Brodex is a thin wrapper of :brod
.
Configuration
See brod README for details.
config :brod,
clients: [
my_client: [
endpoints: [{'127.0.0.1', 9092}],
reconnect_cool_down_seconds: 10
]
]
If you use mix release
# config/releases.exs
config :brod,
clients: [
my_client: [
endpoints: Brodex.parse_endpoints(System.fetch_env!("KAFKA_ENDPOINTS)),
reconnect_cool_down_seconds: 10
]
]
Link to this section Summary
Link to this section Types
Link to this type
bootstrap()
View Sourcebootstrap() :: [endpoint()] | {[endpoint()], client_config()}
Link to this type
endpoint()
View Sourceendpoint() :: {binary() | :inet.hostname(), non_neg_integer()}
Link to this type
fetch_opt()
View Sourcefetch_opt() :: {:max_wait_time, non_neg_integer()} | {:min_bytes, non_neg_integer()} | {:max_bytes, non_neg_integer()}
Link to this type
int64()
View Sourceint64() :: -9_223_372_036_854_775_808..9_223_372_036_854_775_807
Link to this type
partitioner()
View Sourcepartitioner() :: (topic(), pos_integer(), key(), value() -> {:ok, partition()}) | :random | :hash
Link to this section Functions
Link to this function
fetch(conn_spec, topic, partition, offset, options \\ [])
View Sourcefetch( connection() | client_id() | bootstrap(), topic(), partition(), offset(), [fetch_opt()] ) :: {:ok, {offset(), [Brodex.Message.record()]}} | {:error, term()}
Wrapper of :brod.fetch/5
Link to this function
get_metadata(endpoints, topic, connect_config \\ [])
View Sourceget_metadata([endpoint()], :all | [topic()], :brod.conn_config()) :: {:ok, :kpro.struct()} | {:error, term()}
Wrapper of :brod.get_metadata/3
Link to this function
get_partitions_count(client, topic)
View Sourceget_partitions_count(client(), topic()) :: {:ok, pos_integer()} | {:error, term()}
Wrapper of :brod.get_partitions_count/2
Link to this function
list_all_consumer_groups(endpoints, connect_config \\ [])
View Sourcelist_all_consumer_groups([endpoint()], :brod.conn_config()) :: [ {endpoint(), [:brod.cg()] | {:error, term()}} ]
Wrapper of :brod.list_all_groups/2
Link to this function
list_consumer_groups(endpoint, connect_config \\ [])
View Sourcelist_consumer_groups(endpoint(), :brod.conn_config()) :: {:ok, [:brod.cg()]} | {:error, term()}
Wrapper of :brod.list_groups/2
Parse endpoints.
Examples
iex> Brodex.parse_endpoints("kafka1:9000,kafka:9001")
[{'kafka1', 9000}, {'kafka', 9001}]
Wrapper of :brod.produce/5
.
Wrapper of :brod.produce_sync/5
.
Link to this function
start_client(endpoints, client_id, options \\ [])
View Sourcestart_client([endpoint()], client_id(), :brod.client_config()) :: :ok | {:error, term()}
Wrapper of :brod.start_client/3
.
Link to this function
start_consumer(client, topic, consumer_config \\ [])
View Sourcestart_consumer(client(), topic(), consumer_config()) :: :ok
Wrapper of :brod.start_consumer/3
.
Link to this function
start_producer(client, topic, producer_config \\ [])
View Sourcestart_producer(client(), topic(), producer_config()) :: :ok
Wrapper of :brod.start_producer/3
.
Wrapper of :brod.stop_client/1
.