public CosmosContext(CosmosChangeFeedConfig config) { var retriesOn429Throttling = 1; // Number of retries before failing processing when provisioned RU/s limit in CosmosDb is breached var timeout = TimeSpan.FromSeconds(config.Cosmos.Timeout); // Timeout applied per request to CosmosDb, including retry attempts _discovery = Discovery.FromConnectionString(config.Cosmos.ConnectionStringWithUriAndKey); _connector = new Connector(timeout, retriesOn429Throttling, 5, Log.Logger, mode: config.Cosmos.Mode); _source = new ContainerId(config.Cosmos.Database, config.Cosmos.Container); _aux = new ContainerId(config.Cosmos.Database, config.AuxContainerName); _leaseId = config.ConsumerGroupName; _maxDocuments = config.MaxDocuments; MaxReadAhead = config.MaxReadAhead; MaxConcurrentStreams = config.MaxWriters; _lagFrequencyMinutes = config.LagFreqM; }
public CosmosContext(CosmosConfig config) { _cache = new Cache("Cosmos", config.CacheMb); var retriesOn429Throttling = 1; // Number of retries before failing processing when provisioned RU/s limit in CosmosDb is breached var timeout = TimeSpan.FromSeconds(5); // Timeout applied per request to CosmosDb, including retry attempts var discovery = Discovery.FromConnectionString(config.ConnectionStringWithUriAndKey); _connect = async() => { var gateway = await Connect("App", config.Mode, discovery, timeout, retriesOn429Throttling, timeout); var containers = new Containers(config.Database, config.Container); _store = new Context(gateway, containers); }; }