Container.GetChangeFeedStreamIterator Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
This method creates an iterator to consume a Change Feed.
public abstract Microsoft.Azure.Cosmos.FeedIterator GetChangeFeedStreamIterator (Microsoft.Azure.Cosmos.ChangeFeedStartFrom changeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode changeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions changeFeedRequestOptions = default);
abstract member GetChangeFeedStreamIterator : Microsoft.Azure.Cosmos.ChangeFeedStartFrom * Microsoft.Azure.Cosmos.ChangeFeedMode * Microsoft.Azure.Cosmos.ChangeFeedRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
Public MustOverride Function GetChangeFeedStreamIterator (changeFeedStartFrom As ChangeFeedStartFrom, changeFeedMode As ChangeFeedMode, Optional changeFeedRequestOptions As ChangeFeedRequestOptions = Nothing) As FeedIterator
Parameters
- changeFeedStartFrom
- ChangeFeedStartFrom
Where to start the changefeed from.
- changeFeedMode
- ChangeFeedMode
Defines the mode on which to consume the change feed.
- changeFeedRequestOptions
- ChangeFeedRequestOptions
(Optional) The options for the Change Feed consumption.
Returns
An iterator to go through the Change Feed.
Examples
ChangeFeedRequestOptions options = new ChangeFeedRequestOptions()
{
PageSizeHint = 10,
}
FeedIterator feedIterator = this.Container.GetChangeFeedStreamIterator(
ChangeFeedStartFrom.Beginning(),
ChangeFeedMode.Incremental,
options);
while (feedIterator.HasMoreResults)
{
using (ResponseMessage response = await feedIterator.ReadNextAsync())
{
if (response.StatusCode == NotModified)
{
// No new changes
// Capture response.ContinuationToken and break or sleep for some time
}
else
{
using (StreamReader sr = new StreamReader(response.Content))
using (JsonTextReader jtr = new JsonTextReader(sr))
{
JObject result = JObject.Load(jtr);
}
}
}
}
Applies to
See also
Met ons samenwerken op GitHub
De bron voor deze inhoud vindt u op GitHub, waar u ook problemen en pull-aanvragen kunt maken en controleren. Bekijk onze gids voor inzenders voor meer informatie.
Azure SDK for .NET
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort beschikbaar: In de loop van 2024 zullen we GitHub-problemen geleidelijk uitfaseren als het feedbackmechanisme voor inhoud en deze vervangen door een nieuw feedbacksysteem. Zie voor meer informatie:Feedback verzenden en weergeven voor