/// <summary> /// Subscribes a callback against the <see cref="MessageHub"/> for a specific type of message. /// </summary> /// <typeparam name="T">The type of message to subscribe to</typeparam> /// <param name="action">The callback to be invoked once the message is published on the <see cref="MessageHub"/></param> /// <param name="throttleBy">The <see cref="TimeSpan"/> specifying the rate at which subscription is throttled</param> /// <returns>The token representing the subscription</returns> public Guid Subscribe <T>(Action <T> action, TimeSpan throttleBy) { EnsureNotNull(action); EnsureNotDisposed(); return(Subscriptions.Register(throttleBy, action)); }
public Guid Subscribe <T>(Action <T> action, Predicate <T> filter, TimeSpan throttleBy) { EnsureNotNull(action); EnsureNotNull(filter); return(Subscriptions.Register(throttleBy, action, filter)); }
/// <summary> /// Subscribes a callback against the <see cref="MessageHub"/> for a specific type of message. /// </summary> /// <typeparam name="T">The type of message to subscribe to</typeparam> /// <param name="action">The callback to be invoked once the message is published on the <see cref="MessageHub"/></param> /// <param name="throttleBy">The <see cref="TimeSpan"/> specifying the rate at which subscription is throttled</param> /// <returns>The token representing the subscription</returns> public Guid Subscribe <T>(Func <T, Task> action, TimeSpan throttleBy) { EnsureNotNull(action); return(Subscriptions.Register(throttleBy, action)); }