Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.35k stars 2.7k forks source link

Get service bus sender client by name regardless of type (queue/topic) #36192

Open ietz opened 1 week ago

ietz commented 1 week ago

Is your feature request related to a problem? Please describe. I would like a way to send messages to an Azure Service Bus entity without needing to know in advance if the entity is a topic or a queue. Currently, the only way to send a message is by first creating a ServiceBusClient and using its .get_queue_sender or .get_topic_sender method to get a ServiceBusSender instance and then using its .send_messages method.

Having to know the type in advance limits the usefulness of the message ReplyTo property for a request-response pattern where some of the responses need to be delivered to a queue while others need to be delivered to a topic.

Describe the solution you'd like Merge the .get_queue_sender and .get_topic_sender methods into a .get_sender method that takes a shared queue_or_topic_name: string parameter, instead of having separate methods or parameters queue_name: string and topic_name: string. As far as I can tell from the docs, this is exactly what the Service Bus .NET SDK does with the ServiceBusClient.CreateSender(string queueOrTopicName) method.

Describe alternatives you've considered Two potential solutions that would work with the current SDK:

Both should work but seem like workarounds and should not be necessary given that the .NET API does not have these limitations

github-actions[bot] commented 1 week ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.