fsprojects / pulsar-client-dotnet

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

Topic Name requires a certain format #256

Open dmarsh12 opened 7 months ago

dmarsh12 commented 7 months ago

Hi there! When trying to set a topic name in the non-conventional format such as ":persistant/default/local/some.namespace/some.othernamespace/topic" it throws an error saying the topic name is incorrect. It expects the format to either be a single string, or be separated by 3 "/".

However, I do not see any actual limitation in Pulsar/DotPulsar doing the same. While I do see recommendations from Pulsar, there is nothing in DotPulsar preventing you from doing so and the provided example topic is perfectly valid in DotPulsar. Is there a particular reason why it's not allowed in the PulsarClient? I believe there should be an option to set the fully qualified topic like the example provided and not have such limitations built into the name.

Here is the relevant code: https://github.com/fsprojects/pulsar-client-dotnet/blob/develop/src/Pulsar.Client/Common/TopicName.fs

Currently, I see the error generated on line 53 as it assumes I am inputting a short topic name instead of a fully qualified topic.

Lanayx commented 7 months ago

In pulsar topic names always follow conventional format where tenant, namespace and name are separates with slashes. If you are to put more slashes in, it becomes confusing - what is what, so you should expect tooling to break often. Still, Pulsar.Client closely followes Java implementation, so if it's allowed there, you can create PR with change. DotPulsar implementation details are not taken into account at any time.