fsprojects / pulsar-client-dotnet

Apache Pulsar native client for .NET (C#/F#/VB)
MIT License
301 stars 47 forks source link

Question-What are the best practices for using a Producer to send to different topics? #236

Closed Genuineh closed 11 months ago

Genuineh commented 11 months ago

Thank you very much for your contribution. However, I did not find any documentation regarding the best practices for producers in use. So I would like to inquire, for better performance, is it better to have a singleton for each topic or a connection pool for each topic? Of course, if the library already includes relevant content, I just need to continuously construct new producers, which is the most friendly option for me.

Lanayx commented 11 months ago

Hi, Genuineh! For better performance you should use one producer per topic, since it will leverage messages batching. (I hope I've understood your question correctly)

Genuineh commented 11 months ago

Thanks