Cosmos Db Change Feed 没有给出预期的结果

Cosmos Db Change Feed do not give the desired result

我正在尝试按照以下代码从我在 Cosmos 数据库更改源中监视的数据库中获取所有更改。我正在尝试不同的持续时间,例如今天发生的变化或过去 7 天发生的变化或整体发生的变化。现在在所有情况下,我第一次得到所有变化,第二次没有变化 运行 除非有变化。我想知道我在这里做错了什么,如果我只需要上周对我的每个 运行 进行更改,如果我的以下代码不正确,我应该如何配置更改源。提前致谢

 private static CosmosClient Client { get; set; }
    static void Main(string[] args)
    {
        Task.Run(async () =>
        {
            Client = new CosmosClient("AccountEndpoint = https://test.documents.azure.com:443/;AccountKey=FW5yvDA==;");
            var database = Client.GetDatabase("twstDatabase");
            var container = database.GetContainer("TestContainer");
            var leaseContainer = database.GetContainer("leases");

            var cfp = container.GetChangeFeedProcessorBuilder<dynamic>("cfpLibraryDThird", ProcessChanges)
                .WithLeaseContainer(leaseContainer)
                .WithInstanceName("Change Feed Instance Demo") 
// I change the instance name for different start time
                    .WithStartTime(DateTime.Today.AddDays(-7).ToUniversalTime())
                    //.WithStartTime(DateTime.MinValue.ToUniversalTime())
                    .Build();
                await cfp.StartAsync();
                Console.WriteLine("Started Change feed processor- press key to stop");
                Console.ReadKey(true);
                await cfp.StopAsync();
            }).Wait();
        }

        static async Task ProcessChanges(IReadOnlyCollection<dynamic> docs, CancellationToken cancellationToken)
        {
            foreach (var doc in docs)
            {
                Console.WriteLine($"Document {doc.id} has changed");
                
            }
        }
    }
}

这是 3.15 的错误,您可以在此处跟踪此问题 https://github.com/Azure/azure-cosmos-dotnet-v3/issues/2031

已修复为 3.15.1。我更新了软件包并解决了问题。