Esempio n. 1
0
        /// <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);
            }
        }
Esempio n. 2
0
 public static Recorded <INotification <T> > OnCompleted <T>(long ticks)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnCompleted <T>()));
 }
Esempio n. 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)));
 }
Esempio n. 4
0
 public static Recorded <INotification <T> > OnError <T>(long ticks, Exception error)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnError <T>(error)));
 }
Esempio n. 5
0
 public static Recorded <INotification <T> > OnNext <T>(long ticks, T value)
 {
     return(new Recorded <INotification <T> >(ticks, ObserverNotification.CreateOnNext <T>(value)));
 }
Esempio n. 6
0
 public void OnCompleted()
 {
     _messageRouter.Publish(_topic, ObserverNotification.CreateOnCompleted <byte[]>());
 }
Esempio n. 7
0
 public void OnError(Exception error)
 {
     _messageRouter.Publish(_topic, ObserverNotification.CreateOnError <byte[]>(error));
 }
Esempio n. 8
0
        public void OnNext(TSource value)
        {
            var serialized = _serializer.ToBytes(value);

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