Hi @Ankit Kumar , welcome to Microsoft Q&A.
We just noticed that you had posted the similar query on GitHub forum and it mentioned that its bug with .NET SDK 3.15 and will work with earlier version.
Posting it here again for broader audience.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to get all the changes from my monitored Db in the Cosmos db Change Feed by following the below codes. I am trying for different duration like the changes happening today or the changes happened in last 7 days or changes happened overall. Now in all the cases I get all the changes in first time and no changes in the second run unless there is a change coming. I would like to know what wrong am I doing here, and If I have to get changes for only last week on my each run, How should I configure the change feed if my below code is not correct. Thanks in Advance.
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");
}
}
}
}
Hi @Ankit Kumar , welcome to Microsoft Q&A.
We just noticed that you had posted the similar query on GitHub forum and it mentioned that its bug with .NET SDK 3.15 and will work with earlier version.
Posting it here again for broader audience.