Container.GetChangeFeedIterator<T> 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<T> GetChangeFeedIterator<T> (Microsoft.Azure.Cosmos.ChangeFeedStartFrom changeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode changeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions changeFeedRequestOptions = default);
abstract member GetChangeFeedIterator : Microsoft.Azure.Cosmos.ChangeFeedStartFrom * Microsoft.Azure.Cosmos.ChangeFeedMode * Microsoft.Azure.Cosmos.ChangeFeedRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetChangeFeedIterator(Of T) (changeFeedStartFrom As ChangeFeedStartFrom, changeFeedMode As ChangeFeedMode, Optional changeFeedRequestOptions As ChangeFeedRequestOptions = Nothing) As FeedIterator(Of T)
Type Parameters
- T
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<MyItem> feedIterator = this.Container.GetChangeFeedIterator<MyItem>(
ChangeFeedStartFrom.Beginning(),
ChangeFeedMode.Incremental,
options);
while (feedIterator.HasMoreResults)
{
FeedResponse<MyItem> response = await feedIterator.ReadNextAsync();
if (response.StatusCode == NotModified)
{
// No new changes
// Capture response.ContinuationToken and break or sleep for some time
}
else
{
foreach (var item in response)
{
Console.WriteLine(item);
}
}
}
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for .NET