/// <summary>
        /// Enumerate the connections invoking the callback for each connection
        /// </summary>
        /// <param name="callback">The callback</param>
        /// <returns>An awaitable Task for the operation</returns>
        public void Notify(ObserverNotification callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            if (_connections.Count == 0)
            {
                return;
            }

            foreach (Handle observer in _connections.Values)
            {
                observer.Notify(callback);
            }
        }
Exemple #2
0
 public static Recorded <INotification <T> > OnCompleted <T>(long ticks)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnCompleted <T>()));
 }
Exemple #3
0
 public static Recorded <INotification <T> > OnError <T>(long ticks, Func <Exception, bool> predicate)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnError <T>(predicate)));
 }
Exemple #4
0
 public static Recorded <INotification <T> > OnError <T>(long ticks, Exception error)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnError <T>(error)));
 }
Exemple #5
0
 public static Recorded <INotification <T> > OnNext <T>(long ticks, T value)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnNext <T>(value)));
 }
 public void OnCompleted()
 {
     _messageRouter.Publish(_topic, ObserverNotification.CreateOnCompleted <byte[]>());
 }
 public void OnError(Exception error)
 {
     _messageRouter.Publish(_topic, ObserverNotification.CreateOnError <byte[]>(error));
 }
        public void OnNext(TSource value)
        {
            var serialized = _serializer.ToBytes(value);

            _messageRouter.Publish(_topic, ObserverNotification.CreateOnNext <byte[]>(serialized));
        }
 public void Notify(ObserverNotification notification)
 {
     notification(_observer);
 }