-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Description
Hi,
I am using msgraph sdk to get 'User' details in an application. Initialized the GraphServiceClient for app-only authentication as specified in the tutorial: https://learn.microsoft.com/en-us/graph/tutorials/java-app-only?tabs=aad&tutorial-step=3.
I want to query the 'users' using certain filter and select criteria, e.g.
_appClient.users().get(requestConfig -> {
requestConfig.queryParameters.filter = "displayName startsWith \'A\'";
requestConfig.queryParameters.select = new String[] { "displayName", "id", "mail" };
requestConfig.queryParameters.top = 25;
requestConfig.queryParameters.orderby = new String[] { "displayName" };
});
However, this request may happen from the context of different threads.
My queries are:
- Does each thread need to instantiate GraphServiceClient separately, or, can we initialize once and share across threads?
- If _appClient (i.e the instance of GraphServiceClient) can be shared, is it thread-safe or do we need to synchronize access to it?
Any insight will be helpful.
The following artifact versions are used: microsoft-graph (v 6.20.0) and azure-identity (1.14.1).