1stSolo
So far I hadn’t been able to figure out how to get or set topic retention values for kafka topics via brod, using versions up to 3.16.3. I can set it when creating a topic by passing name-value pairs when creating topic.
config = [
%{name: "retention.ms", value: "-1"},
%{name: "retention.bytes", value: "-1"}
]
Is this even possible via Brod, or one must install Java and kafka client libraries and invoke kafka-configs.sh or kafka_topics.sh to do it? It seems like a huge limitation. For example, I can’t drop and re-create a topic with same retention because I don’t have all of the metadata.
However, I’m looking at https://hexdocs.pm/brod/3.16.3/brod_client.html#get_metadata/2 and it should return
struct()
struct() = #{field_name() => field_value()} | [{field_name(), field_value()}]
but I’m getting a different struct…
I must be missing something.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lud
What are you receiving as metadata then? Is the field just missing or are you not receiving
{ok, kpro:struct()} | {error, any()}?1stSolo
I’m getting
lud
So it does indeed return
{ok, #{field_name() => field_value()}}but yeah, sorry, I don’t know another way to get that info. You may look into thekafka_protocolapplication (kpromodules and friends) but you may have to encode and decode the request yourself.1stSolo
This looks promising, but I need help translating erlang to Elixir.
API spec: kafka_protocol/src/kpro_req_lib.erl at 7147d6e16652b9b1c39758250bdf93ee934ec706 · kafka4beam/kafka_protocol · GitHub
struct():
https://github.com/kafka4beam/kafka_protocol/blob/7147d6e16652b9b1c39758250bdf93ee934ec706/src/kpro.erl#L193
code:
output:
as the next step, I want to try to use kafka_protocol/src/kpro_req_lib.erl at 7147d6e16652b9b1c39758250bdf93ee934ec706 · kafka4beam/kafka_protocol · GitHub
Also, I don’t understand how to pass in the broker or zk information here - how does it get connected? Can’t find examples anywhere…
1stSolo
I solved it using
kafka_protocollibrary, although it was quite a brain tease to figure out how to call Erlang from Elixir, by wrapping:kpro_req_lib.describe_configs,:kpro_brokers.with_connection,:brod_utils.request_syncand:kpro_req_lib.alter_configsAPIs. It was very helpful to go through the source code for the unit tests included with kafka_protocol library.