question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion] Service Bus - Track 2 - Methods to create senders/receivers should use the verb create, not get

See original GitHub issue

The intent of this issue is to solicit feedback from the team and the community in advance of the GA of the next major version of the Service Bus library (which will follow several Preview releases). As a reference, the .NET Azure SDK guidelines can be found here: https://azure.github.io/azure-sdk/dotnet_introduction.html Terminology: Track 0 refers to the WindowsAzure.ServiceBus library Track 1 refers to the Microsoft.Azure.ServiceBus library Track 2 refers to the new library, Azure.Messaging.ServiceBus, we are working on releasing.

We have the below methods on the ServiceBusClient in the first Preview of the Track 2 library to create senders and receivers

  • GetSender
  • GetReceiver
  • GetDeadletterReceiver
  • GetSessionReceiverAsync

I’d like to propose that these methods use the create verb instead for the following reasons

  • These methods do not “get” anything from the service, rather they create objects that represent an AMQP link to the service.
  • At every invocation, these methods return a new sender/receiver that represent a new AMQP link. The get verb would imply that you get the same thing at every invocation
  • AMQP links are finite resources. It should be clear to the user that its on them to clean up senders/receivers and use them responsibly
  • At any given point in time, we can have only 1 receiver for a given session Id. the name GetSessionReceiverAsync() suggests I am getting the same receiver, but in reality on second invocation, I get an error because the new receiver cannot get a lock on the session. Since when do “getter” like function throw error that I am asking for the same thing again?
  • The “get” verb on methods that create sub clients as per the guidelines (like we followed for Storage with GetAppendBlobClient) make sense when the client is a stateless object with helpful methods and nothing actually gets created on the service. In our case, we have links being created connecting the client & service & authentication being carried out.

cc @bterlson, @KrzysztofCwalina, @JoshLove-msft, @jsquire, @ShivangiReja, @AlexGhiondea

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
danielmarbachcommented, Apr 27, 2020

This can be closed right?

0reactions
KrzysztofCwalinacommented, Apr 3, 2020

I like changing these methods to Create. The methods have significant side effects and the returned objects should be disposed. Create makes it more clear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

queues, topics, and subscriptions - Azure Service Bus
This article provides an overview of Azure Service Bus messaging entities (queue, topics, and subscriptions).
Read more >
Is having multiple producers for the same topic in Azure ...
In my application, there are two independent sources that could produce the same message type. I know there are not going to be...
Read more >
Send messages to clients using Azure Service Bus - Topics
Now you can create two methods in same function SendEmail(), sendPhoneNotifcation() and parrellize the tasks using C# task parallel library. So ...
Read more >
Support for multiple topics and subscriptions in one instance
I use configuration with Azure Service Bus (AddConsumers, SubscriptionEndpoint methods).
Read more >
Subscribe to topics or to messages on those topics?
For example, in the Azure service bus, you can use explorer to see your subscriptions' "queues" and get directly to the message types...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found