silviucpp / erlkaf

Erlang kafka driver based on librdkafka
MIT License
84 stars 41 forks source link

Support deleting topics #56

Open ding-an-sich opened 1 year ago

ding-an-sich commented 1 year ago

It would be useful for cleaning up the state of the broker when using erlkaf in tests that produce to random topics that we are not really interested to be long lived.

For example:

setup_all do
  :erlkaf.create_producer(TestProducer, [])
  topic = "random_test_topic_#{Ecto.UUID.generate()}"
  :ok = :erlkaf.create_topic(TestProducer, topic)

  on_exit(fn ->
      :erlkaf.delete_topic(TestProducer, topic)
      :erlkaf.stop_client(TestProducer)
  end)
end

Pardon my Elixir.

silviucpp commented 1 year ago

This can be implemented. The native function for delete topic is here: https://github.com/confluentinc/librdkafka/blob/1f9f245ac409f50f724695c628c7a0d54a763b9a/src/rdkafka.h#L5574

Unfortunately my time is very limited . so a pull request is welcome !

Silviu