ah- / rdkafka-dotnet

C# Apache Kafka client
Other
242 stars 73 forks source link

Usage guidelines #110

Closed cpx86 closed 7 years ago

cpx86 commented 7 years ago

There isn't much in the documentation in terms of usage guidelines. More specifically, should Producer and/or Topic instances be re-used or should singleton instances be used? What is the cost of creating new instances of each? What happens when they are disposed?

ah- commented 7 years ago

They're relatively heavy-weight as they create threads to communicate with the different brokers. I'd recommend creating only few instances.

When you dispose them they're shut down and they need to do quite a bit of work again on construction.

cpx86 commented 7 years ago

I suspected as much, but good to have verified :) Would be nice to have that info in the examples.