Steve Pettifer
Steve Pettifer

Reputation: 2043

Is the Azure EventGridClient thread safe?

A lot of the Azure client libraries seem to be thread safe and I'm nearly sure I read somewhere that the EventGridClient is too, but I cannot for the life of me find where that was. The MSDN documentation makes no mention either way but I know that there have been cases where the documentation is incorrect.

Can anyone confirm or deny this and provide a source for it, as either my Google-fu is weak today or it simply hasn't been stated anywhere. Cheers.

Upvotes: 0

Views: 368

Answers (2)

VektorPixel
VektorPixel

Reputation: 11

For anybody stumbling over this Question: The client is thread safe accord in the SDK readme.md:

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/eventgrid/Azure.Messaging.EventGrid/README.md#thread-safety

Thread safety

We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.

Upvotes: 0

Felice Pollano
Felice Pollano

Reputation: 33272

As far as I know the rule of thumb in .NET libraries is that instance method are not supposed to be thread safe, while statics are. So if not documented I think this is what we have to consider. Furthermore an instance method could be incidentally thread safe, but since is not documented it could change behavior in future versions, so you should not trust the situation.

Upvotes: 1

Related Questions