-
Notifications
You must be signed in to change notification settings - Fork 2k
/
StreamSubscriptionHandle.cs
49 lines (43 loc) · 2.01 KB
/
StreamSubscriptionHandle.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Threading.Tasks;
namespace Orleans.Streams
{
/// <summary>
/// Handle representing this subscription.
/// Consumer may serialize and store the handle in order to unsubscribe later, for example
/// in another activation on this grain.
/// </summary>
[Serializable]
public abstract class StreamSubscriptionHandle<T> : IEquatable<StreamSubscriptionHandle<T>>
{
public abstract IStreamIdentity StreamIdentity { get; }
public abstract string ProviderName { get; }
/// <summary>
/// Unique identifier for this StreamSubscriptionHandle
/// </summary>
public abstract Guid HandleId { get; }
/// <summary>
/// Unsubscribe a stream consumer from this observable.
/// </summary>
/// <returns>A promise to unsubscription action.
/// </returns>
public abstract Task UnsubscribeAsync();
/// <summary>
/// Resumed consumption from a subscription to a stream.
/// </summary>
/// <param name="observer">The Observer object.</param>
/// <param name="token">The stream sequence to be used as an offset to start the subscription from.</param>
/// <returns>A promise with an updates subscription handle.
/// </returns>
public abstract Task<StreamSubscriptionHandle<T>> ResumeAsync(IAsyncObserver<T> observer, StreamSequenceToken token = null);
/// <summary>
/// Resume batch consumption from a subscription to a stream.
/// </summary>
/// <param name="observer">The batcj bserver object.</param>
/// <param name="token">The stream sequence to be used as an offset to start the subscription from.</param>
/// <returns>A promise with an updates subscription handle.
/// </returns>
public abstract Task<StreamSubscriptionHandle<T>> ResumeAsync(IAsyncBatchObserver<T> observer, StreamSequenceToken token = null);
public abstract bool Equals(StreamSubscriptionHandle<T> other);
}
}