Class ObserverSubscriptionManager<T>
The ObserverSubscriptionManager class is a helper class for grains that support observers. It provides methods for tracking subscribing observers and for sending notifications.
Inheritance
Namespace: Orleans
Assembly: Orleans.Core.Legacy.dll
Syntax
public class ObserverSubscriptionManager<T> : object where T : IGrainObserver
Type Parameters
Name | Description |
---|---|
T | The observer interface type to be managed. |
Constructors
| Improve this Doc View SourceObserverSubscriptionManager()
Constructs an empty subscription manager.
Declaration
public ObserverSubscriptionManager()
Properties
| Improve this Doc View SourceCount
Number of subscribers currently registered
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceClear()
Removes all subscriptions.
Declaration
public void Clear()
IsSubscribed(T)
Determines if the SubscriptionManager has the input observer
Declaration
public bool IsSubscribed(T observer)
Parameters
Type | Name | Description |
---|---|---|
T | observer | True if the the observer is already subscribed, otherwise False. |
Returns
Type | Description |
---|---|
System.Boolean | True is the SubscriptionManager has the input observer. |
Notify(Action<T>)
Sends a notification to all subscribers.
Declaration
public void Notify(Action<T> notification)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | notification | An action that sends the notification by invoking the proper method on the provided subscriber. This action is called once for each current subscriber. |
Subscribe(T)
Records a new subscribing observer.
Declaration
public void Subscribe(T observer)
Parameters
Type | Name | Description |
---|---|---|
T | observer | The new subscriber. |
Unsubscribe(T)
Removes a (former) subscriber.
Declaration
public void Unsubscribe(T observer)
Parameters
Type | Name | Description |
---|---|---|
T | observer | The unsubscribing observer. |