ConnectionPolicy interface
代表 Azure Cosmos DB 資料庫服務中與 CosmosClient 相關聯的連線原則。
屬性
connection |
決定要連線到 Cosmos 的模式。 (目前僅支援閘道選項) |
enable |
啟用/停用端點背景重新整理的旗標。 默認值為 false。
使用 |
enable |
旗標,以根據讀取/寫入作業啟用/停用要求的自動重新導向。 默認值為 true。 在終結另一個進程或瀏覽器中的 CosmosClient 之後,呼叫 client.dispose() 時,呼叫 client.dispose() 的必要專案。 |
endpoint |
以毫秒為單位的速率,用戶端會在背景重新整理端點清單 |
preferred |
要作為讀取要求慣用位置的 Azure 區域清單。 |
request |
要求逾時(等候來自網路對等互連的回應時間)。 以毫秒表示。 |
retry |
RetryOptions 物件,定義重試期間使用的數個可設定屬性。 |
use |
旗標,可針對 Azure Cosmos DB 服務中的異地復寫資料庫帳戶,針對任何位置(區域)進行寫入。
預設值為 |
屬性詳細資料
connectionMode
enableBackgroundEndpointRefreshing
啟用/停用端點背景重新整理的旗標。 默認值為 false。
使用 enableEndpointsDiscovery
的端點探索仍適用於失敗的要求。
enableBackgroundEndpointRefreshing?: boolean
屬性值
boolean
enableEndpointDiscovery
旗標,以根據讀取/寫入作業啟用/停用要求的自動重新導向。 默認值為 true。 在終結另一個進程或瀏覽器中的 CosmosClient 之後,呼叫 client.dispose() 時,呼叫 client.dispose() 的必要專案。
enableEndpointDiscovery?: boolean
屬性值
boolean
endpointRefreshRateInMs
以毫秒為單位的速率,用戶端會在背景重新整理端點清單
endpointRefreshRateInMs?: number
屬性值
number
preferredLocations
要作為讀取要求慣用位置的 Azure 區域清單。
preferredLocations?: string[]
屬性值
string[]
requestTimeout
要求逾時(等候來自網路對等互連的回應時間)。 以毫秒表示。
requestTimeout?: number
屬性值
number
retryOptions
useMultipleWriteLocations
旗標,可針對 Azure Cosmos DB 服務中的異地復寫資料庫帳戶,針對任何位置(區域)進行寫入。
預設值為 false
。
useMultipleWriteLocations?: boolean
屬性值
boolean