Change ConnectionMode to Gateway in CosmosDbScalerProvider (#910)
* Change ConnectionMode to Gateway in CosmosDbScalerProvider * Update version
This commit is contained in:
Родитель
29164e1fbe
Коммит
2e7550f723
|
@ -3,7 +3,7 @@
|
|||
<!-- Extensions can have independent versions and only increment when released -->
|
||||
<Version>3.0.0$(VersionSuffix)</Version>
|
||||
<ExtensionsVersion>5.1.0$(VersionSuffix)</ExtensionsVersion> <!-- WebJobs.Extensions -->
|
||||
<CosmosDBVersion>4.8.1$(VersionSuffix)</CosmosDBVersion>
|
||||
<CosmosDBVersion>4.8.2$(VersionSuffix)</CosmosDBVersion>
|
||||
<HttpVersion>3.2.0$(VersionSuffix)</HttpVersion>
|
||||
<MobileAppsVersion>3.0.0$(VersionSuffix)</MobileAppsVersion>
|
||||
<SendGridVersion>3.0.3$(VersionSuffix)</SendGridVersion>
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Microsoft.Azure.WebJobs.Extensions.CosmosDB.Trigger
|
|||
ILoggerFactory loggerFactory = serviceProvider.GetService<ILoggerFactory>();
|
||||
CosmosDbMetadata cosmosDbMetadata = JsonConvert.DeserializeObject<CosmosDbMetadata>(triggerMetadata.Metadata.ToString());
|
||||
cosmosDbMetadata.ResolveProperties(serviceProvider.GetService<INameResolver>());
|
||||
IOptions<CosmosClientOptions> options = serviceProvider.GetService<IOptions<CosmosClientOptions>>();
|
||||
ICosmosDBServiceFactory serviceFactory = new DefaultCosmosDBServiceFactory(config, azureComponentFactory);
|
||||
CosmosClient cosmosClient = serviceFactory.CreateService(cosmosDbMetadata.Connection, options.Value);
|
||||
CosmosClient cosmosClient = serviceFactory.CreateService(cosmosDbMetadata.Connection, new CosmosClientOptions
|
||||
{
|
||||
ConnectionMode = ConnectionMode.Gateway
|
||||
});
|
||||
var monitoredContainer = cosmosClient.GetContainer(cosmosDbMetadata.DatabaseName, cosmosDbMetadata.ContainerName);
|
||||
var leaseContainer = cosmosClient.GetContainer(string.IsNullOrEmpty(cosmosDbMetadata.LeaseDatabaseName) ? cosmosDbMetadata.DatabaseName : cosmosDbMetadata.LeaseDatabaseName, string.IsNullOrEmpty(cosmosDbMetadata.LeaseContainerName) ? CosmosDBTriggerConstants.DefaultLeaseCollectionName : cosmosDbMetadata.LeaseContainerName);
|
||||
_scaleMonitor = new CosmosDBScaleMonitor(triggerMetadata.FunctionName, loggerFactory.CreateLogger<CosmosDBScaleMonitor>(), monitoredContainer, leaseContainer, cosmosDbMetadata.LeaseContainerPrefix);
|
||||
|
|
Загрузка…
Ссылка в новой задаче