Class NotificationBase<TMessage>
Defines base functionality for pushing and subscribing to notifications.
Implements
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Notification
Assembly: Sartorius.SAF.dll
Syntax
public abstract class NotificationBase<TMessage> : NotificationService, INotificationService
Type Parameters
Name | Description |
---|---|
TMessage | The type of the message that is pushed to the subscribers. |
Methods
View SourcePublish(TMessage)
Publishes the given message
to all subscribers.
Declaration
public virtual void Publish(TMessage message)
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The message to push. |
Subscribe(Action<TMessage>)
Subscribes a delegate to an event that will be published on the PublisherThread.
Declaration
public virtual SubscriptionToken Subscribe(Action<TMessage> publishAction)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | publishAction | The delegate that gets executed when the event is published. |
Returns
Type | Description |
---|---|
SubscriptionToken | A SubscriptionToken that uniquely identifies the added subscription. |
Subscribe(Action<TMessage>, Predicate<TMessage>)
Subscribes a delegate to an event that will be published on the PublisherThread.
Declaration
public virtual SubscriptionToken Subscribe(Action<TMessage> publishAction, Predicate<TMessage> filter)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | publishAction | The delegate that gets executed when the event is published. |
System.Predicate<TMessage> | filter | The filter. |
Returns
Type | Description |
---|---|
SubscriptionToken | A SubscriptionToken that uniquely identifies the added subscription. |
Unsubscribe(SubscriptionToken)
Removes the subscriber matching SubscriptionToken from the subscribers' list.
Declaration
public virtual void Unsubscribe(SubscriptionToken subscriptionToken)
Parameters
Type | Name | Description |
---|---|---|
SubscriptionToken | subscriptionToken |