erlkaf icon indicating copy to clipboard operation
erlkaf copied to clipboard

Support deleting topics

Open ding-an-sich opened this issue 2 years ago • 1 comments
trafficstars

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.

ding-an-sich avatar Jan 12 '23 18:01 ding-an-sich

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

silviucpp avatar Jan 12 '23 21:01 silviucpp