Ejemplo n.º 1
0
 public IObservable <IDeliveryArgs> CreateProcessedEventNotificationsObservable(
     DEventNotificationHandler processOneAsync)
 {
     return(Observable
            .Defer(() => RegisterEventNotificationsHandler(processOneAsync))
            .Do(args => Pulse()));
 }
Ejemplo n.º 2
0
 public IDisposable ProcessEventNotifications(DEventNotificationHandler processOneAsync)
 {
     if (processOneAsync == null)
     {
         throw new ArgumentNullException(nameof(processOneAsync));
     }
     return(CreateProcessedEventNotificationsObservable(processOneAsync)
            .Subscribe());
 }
Ejemplo n.º 3
0
 public MessageHandlerFactory(AppletDeliveryProcessor processor, MethodInfo[] methods, DEventNotificationHandler fallback)
 {
     if (processor == null)
     {
         throw new ArgumentNullException(nameof(processor));
     }
     if (methods == null)
     {
         throw new ArgumentNullException(nameof(methods));
     }
     _processor = processor ?? throw new ArgumentNullException(nameof(processor));
     _methods   = methods ?? throw new ArgumentNullException(nameof(methods));
     _fallback  = fallback ?? throw new ArgumentNullException(nameof(fallback));
 }
        protected override IObservable <IDeliveryArgs> RegisterEventNotificationsHandler(DEventNotificationHandler processOneAsync)
        {
            if (processOneAsync == null)
            {
                throw new ArgumentNullException(nameof(processOneAsync));
            }
            var cancellation = new CancellationTokenSource();

            return(_topic
                   .Do(args => { }, cancellation.Cancel)
                   .Select(args => new InMemoryDeliveryArgs(args, this))
                   .Where(CanReceiveEventNotification)
                   .SelectMany(async args =>
            {
                await processOneAsync(args, cancellation.Token);
                return args;
            }));
        }
 protected AppletDeliveryProcessor(IAppletChannel channel)
 {
     Channel = channel ?? throw new ArgumentNullException(nameof(channel));
     _generalizedMessageHandler = CreateGeneralizedMessageHandler(channel);
 }
Ejemplo n.º 6
0
 protected abstract IObservable <IDeliveryArgs> RegisterEventNotificationsHandler(
     DEventNotificationHandler processOneAsync);