public final class ConnectionPolicy extends Object
Constructor and Description |
---|
ConnectionPolicy()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ConnectionMode |
getConnectionMode()
Gets the connection mode used in the client.
|
static ConnectionPolicy |
GetDefault()
Gets the default connection policy.
|
boolean |
getEnableEndpointDiscovery()
Gets the flag to enable endpoint discovery for geo-replicated database accounts.
|
int |
getIdleConnectionTimeoutInMillis()
Gets the value of the timeout for an idle connection, the default is 60
seconds.
|
int |
getMaxPoolSize()
Gets the value of the connection pool size the client is using.
|
MediaReadMode |
getMediaReadMode()
Gets the attachment content (aka media) download mode.
|
int |
getMediaRequestTimeoutInMillis()
Gets or sets time to wait for response from network peer for attachment
content (aka media) operations.
|
List<String> |
getPreferredLocations()
Gets the preferred locations for geo-replicated database accounts
|
InetSocketAddress |
getProxy()
Gets the InetSocketAddress of proxy server.
|
int |
getRequestTimeoutInMillis()
Gets the request timeout (time to wait for response from network peer) in
milliseconds.
|
RetryOptions |
getRetryOptions()
Gets the retry policy options associated with the DocumentClient instance.
|
String |
getUserAgentSuffix()
Gets the value of user-agent suffix.
|
Boolean |
isEnableReadRequestsFallback()
Gets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service.
|
boolean |
isUsingMultipleWriteLocations()
Gets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service.
|
void |
setConnectionMode(ConnectionMode connectionMode)
Sets the connection mode used in the client.
|
void |
setEnableEndpointDiscovery(boolean enableEndpointDiscovery)
Sets the flag to enable endpoint discovery for geo-replicated database accounts.
|
void |
setEnableReadRequestsFallback(Boolean enableReadRequestsFallback)
Sets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service.
|
void |
setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis)
sets the value of the timeout for an idle connection.
|
void |
setMaxPoolSize(int maxPoolSize)
Sets the value of the connection pool size, the default
is 1000.
|
void |
setMediaReadMode(MediaReadMode mediaReadMode)
Sets the attachment content (aka media) download mode.
|
void |
setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis)
Gets or sets Time to wait for response from network peer for attachment
content (aka media) operations.
|
void |
setPreferredLocations(List<String> preferredLocations)
Sets the preferred locations for geo-replicated database accounts.
|
void |
setProxy(String proxyHost,
int proxyPort)
This will create the InetSocketAddress for proxy server,
all the requests to cosmoDB will route from this address.
|
void |
setRequestTimeoutInMillis(int requestTimeoutInMillis)
Sets the request timeout (time to wait for response from network peer) in
milliseconds.
|
void |
setRetryOptions(RetryOptions retryOptions)
Sets the retry policy options associated with the DocumentClient instance.
|
void |
setUserAgentSuffix(String userAgentSuffix)
sets the value of the user-agent suffix.
|
void |
setUsingMultipleWriteLocations(boolean usingMultipleWriteLocations)
Sets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service.
|
String |
toString() |
public static ConnectionPolicy GetDefault()
public int getRequestTimeoutInMillis()
public void setRequestTimeoutInMillis(int requestTimeoutInMillis)
requestTimeoutInMillis
- the request timeout in milliseconds.public int getMediaRequestTimeoutInMillis()
public void setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis)
mediaRequestTimeoutInMillis
- the media request timeout in milliseconds.public ConnectionMode getConnectionMode()
public void setConnectionMode(ConnectionMode connectionMode)
connectionMode
- the connection mode.public MediaReadMode getMediaReadMode()
public void setMediaReadMode(MediaReadMode mediaReadMode)
mediaReadMode
- the media read mode.public int getMaxPoolSize()
public void setMaxPoolSize(int maxPoolSize)
maxPoolSize
- The value of the connection pool size.public int getIdleConnectionTimeoutInMillis()
public void setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis)
idleConnectionTimeoutInMillis
- the timeout for an idle connection in seconds.public String getUserAgentSuffix()
public void setUserAgentSuffix(String userAgentSuffix)
userAgentSuffix
- The value to be appended to the user-agent header, this is
used for monitoring purposes.public RetryOptions getRetryOptions()
public void setRetryOptions(RetryOptions retryOptions)
Properties in the RetryOptions class allow application to customize the built-in retry policies. This property is optional. When it's not set, the SDK uses the default values for configuring the retry policies. See RetryOptions class for more details.
retryOptions
- the RetryOptions instance.public boolean getEnableEndpointDiscovery()
public void setEnableEndpointDiscovery(boolean enableEndpointDiscovery)
When EnableEndpointDiscovery is true, the SDK will automatically discover the current write and read regions to ensure requests are sent to the correct region based on the capability of the region and the user's preference.
The default value for this property is true indicating endpoint discovery is enabled.
enableEndpointDiscovery
- true if EndpointDiscovery is enabled.public boolean isUsingMultipleWriteLocations()
public Boolean isEnableReadRequestsFallback()
enableEndpointDiscovery
is true
2. the Azure Cosmos DB account has more than one regionpublic void setUsingMultipleWriteLocations(boolean usingMultipleWriteLocations)
usingMultipleWriteLocations
- flag to enable writes on any locations (regions) for geo-replicated database accounts.public void setEnableReadRequestsFallback(Boolean enableReadRequestsFallback)
enableEndpointDiscovery
is true
2. the Azure Cosmos DB account has more than one regionenableReadRequestsFallback
- flag to enable reads to go to multiple regions configured on an account of Azure Cosmos DB service.public List<String> getPreferredLocations()
public void setPreferredLocations(List<String> preferredLocations)
When EnableEndpointDiscovery is true and PreferredRegions is non-empty, the SDK will prefer to use the locations in the collection in the order they are specified to perform operations.
If EnableEndpointDiscovery is set to false, this property is ignored.
preferredLocations
- the list of preferred locations.public InetSocketAddress getProxy()
public void setProxy(String proxyHost, int proxyPort)
proxyHost
- The proxy server host.proxyPort
- The proxy server port.Copyright © 2019. All rights reserved.