Exemplo n.º 1
0
 internal BlobServiceProperties(string id, string name, string type, Sku sku, CorsRules cors, string defaultServiceVersion, DeleteRetentionPolicy deleteRetentionPolicy, bool?isVersioningEnabled, bool?automaticSnapshotPolicyEnabled, ChangeFeed changeFeed, RestorePolicyProperties restorePolicy, DeleteRetentionPolicy containerDeleteRetentionPolicy) : base(id, name, type)
 {
     Sku  = sku;
     Cors = cors;
     DefaultServiceVersion          = defaultServiceVersion;
     DeleteRetentionPolicy          = deleteRetentionPolicy;
     IsVersioningEnabled            = isVersioningEnabled;
     AutomaticSnapshotPolicyEnabled = automaticSnapshotPolicyEnabled;
     ChangeFeed    = changeFeed;
     RestorePolicy = restorePolicy;
     ContainerDeleteRetentionPolicy = containerDeleteRetentionPolicy;
 }
Exemplo n.º 2
0
 internal BlobServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StorageSku sku, CorsRules cors, string defaultServiceVersion, DeleteRetentionPolicy deleteRetentionPolicy, bool?isVersioningEnabled, bool?automaticSnapshotPolicyEnabled, ChangeFeed changeFeed, RestorePolicyProperties restorePolicy, DeleteRetentionPolicy containerDeleteRetentionPolicy, LastAccessTimeTrackingPolicy lastAccessTimeTrackingPolicy) : base(id, name, resourceType, systemData)
 {
     Sku  = sku;
     Cors = cors;
     DefaultServiceVersion          = defaultServiceVersion;
     DeleteRetentionPolicy          = deleteRetentionPolicy;
     IsVersioningEnabled            = isVersioningEnabled;
     AutomaticSnapshotPolicyEnabled = automaticSnapshotPolicyEnabled;
     ChangeFeed    = changeFeed;
     RestorePolicy = restorePolicy;
     ContainerDeleteRetentionPolicy = containerDeleteRetentionPolicy;
     LastAccessTimeTrackingPolicy   = lastAccessTimeTrackingPolicy;
 }
Exemplo n.º 3
0
        static async Task MainAsync(string[] args)
        {
            try
            {
                //setup our DI
                var serviceProvider = new ServiceCollection()
                                      .AddLogging((builder) =>
                {
                    builder
                    .AddConsole()
                    .SetMinimumLevel(LogLevel.Information);
                })
                                      .AddSingleton <CosmosDbSink>()
                                      .BuildServiceProvider();

                var loggerFactory = serviceProvider.GetService <ILoggerFactory>();
                var logger        = loggerFactory.CreateLogger <Program>();
                logger.LogDebug("Starting application");

                AppDomain.CurrentDomain.FirstChanceException +=
                    new FirstChanceExceptionLogger(loggerFactory).FirstChanceHandler;

                // Set the maximum number of concurrent connections
                ServicePointManager.DefaultConnectionLimit = 1200;

                var changeFeed = new ChangeFeed(new CosmosDbSink(loggerFactory), loggerFactory);

                IChangeFeedProcessor processor = await changeFeed.StartAsync();

                logger.LogInformation("Changefeed started successfully");

                Console.WriteLine("Press any key to stop listening for changes...");
                Console.ReadKey();

                await processor.StopAsync();
            }
            catch (Exception error)
            {
                Console.WriteLine("UNHANDLED EXCEPTION: {0}", error);

                // TODO fabianm REMOVE
                Console.ReadKey();
                throw;
            }
        }
Exemplo n.º 4
0
 public PSChangeFeed(ChangeFeed changeFeed)
 {
     this.Enabled = changeFeed.Enabled;
 }
        internal static BlobServiceData DeserializeBlobServiceData(JsonElement element)
        {
            Optional <Sku>                          sku  = default;
            ResourceIdentifier                      id   = default;
            string                                  name = default;
            ResourceType                            type = default;
            Optional <CorsRules>                    cors = default;
            Optional <string>                       defaultServiceVersion          = default;
            Optional <DeleteRetentionPolicy>        deleteRetentionPolicy          = default;
            Optional <bool>                         isVersioningEnabled            = default;
            Optional <bool>                         automaticSnapshotPolicyEnabled = default;
            Optional <ChangeFeed>                   changeFeed    = default;
            Optional <RestorePolicyProperties>      restorePolicy = default;
            Optional <DeleteRetentionPolicy>        containerDeleteRetentionPolicy = default;
            Optional <LastAccessTimeTrackingPolicy> lastAccessTimeTrackingPolicy   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("cors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cors = CorsRules.DeserializeCorsRules(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("defaultServiceVersion"))
                        {
                            defaultServiceVersion = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("deleteRetentionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            deleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("isVersioningEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isVersioningEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("automaticSnapshotPolicyEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            automaticSnapshotPolicyEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("changeFeed"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            changeFeed = ChangeFeed.DeserializeChangeFeed(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("restorePolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            restorePolicy = RestorePolicyProperties.DeserializeRestorePolicyProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("containerDeleteRetentionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            containerDeleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("lastAccessTimeTrackingPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastAccessTimeTrackingPolicy = LastAccessTimeTrackingPolicy.DeserializeLastAccessTimeTrackingPolicy(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new BlobServiceData(id, name, type, sku.Value, cors.Value, defaultServiceVersion.Value, deleteRetentionPolicy.Value, Optional.ToNullable(isVersioningEnabled), Optional.ToNullable(automaticSnapshotPolicyEnabled), changeFeed.Value, restorePolicy.Value, containerDeleteRetentionPolicy.Value, lastAccessTimeTrackingPolicy.Value));
        }
 public async Task Start()
 {
     CosmosDbProcessor cosmosDbProcessor = new CosmosDbProcessor();
     ChangeFeed        changeFeed        = new ChangeFeed(cosmosDbProcessor);
     await changeFeed.StartAsync();
 }
Exemplo n.º 7
0
 public PSChangeFeed(ChangeFeed changeFeed)
 {
     this.Enabled         = changeFeed.Enabled;
     this.RetentionInDays = changeFeed.RetentionInDays;
 }