I'm developing a class library in .NET that uses Amazon AWS SDK to queue notifications with Amazon SNS, as well as to create new mobile push endpoints. You do this by making requests with a client object that you create like this:
var client = new AmazonSimpleNotificationServiceClient(...);
The ...
is where you'd specify your AWS credentials, in a variety of ways.
Rather than re-creating the client
object every time I'm queuing up a notification or sending some other action to Amazon, I'd like to just create a static version of the client
object, and have each of my methods utilize it.
These methods in my class library may operate in an environment where they are called by multiple threads, or in the case of when we use it in ASP.NET, may be called from multiple web connections in the app pool at once.
Are AmazonSimpleNotificationServiceClient and its methods considered thread-safe? Does anyone see a problem with the way I'm utilizing a static object in this way? Is there a better way to do this, while retaining the efficiency of not having to instantiate a new object every time I'm interacting with SNS? (Eventually we would expect a lot of volume of push notifications being sent using some of these methods.)
They seems to be: