diff --git a/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md b/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md index 36c5933986a8..0ca157a83037 100644 --- a/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md +++ b/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md @@ -113,6 +113,22 @@ from azure.core.pipeline.transport import RequestsTransport synchronous_transport = RequestsTransport() ``` +For example if you would like to alter connection pool you can initialise `RequestsTransport` with an instance of `requests.Session`. + + ```Python + import requests + from azure.core.pipeline.transport import RequestsTransport + session = requests.Session() + adapter = requests.adapters.HTTPAdapter(pool_connections=42, pool_maxsize=42) + session.mount('https://', adapter) + client = FooServiceClient(endpoint, creds, transport=RequestsTransport(session=session, session_owner=False)) + + # Here we want to manage the session by ourselves. When we are done with the session, we need to close the session. + session.close() + + # Note: `session_owner` gives the information of ownership of the requests sessions to the transport instance, to authorize it to close on customer's behalf. If you're ok that the client closes your session on your behalf as necessary, you don't need to pass a value. + ``` + For asynchronous pipelines a couple of transport options are available. Each of these transports are interchangable depending on whether the user has installed various 3rd party dependencies (i.e. aiohttp or trio), and the user should easily be able to specify their chosen transport. SDK developers should use the `aiohttp` transport as the default for asynchronous pipelines where the user has not specified an alternative.